Skip to content

Commit d78cab0

Browse files
authored
Merge pull request #185 from tnull/2023-11-fix-uniffi-and-kotlin-tests
Fix `uniffi-bindgen` and Kotlin full cycle test
2 parents 47b1411 + 296c3b8 commit d78cab0

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ categories = ["cryptography::cryptocurrencies"]
1717
crate-type = ["lib", "staticlib", "cdylib"]
1818
name = "ldk_node"
1919

20-
[[bin]]
21-
name = "uniffi-bindgen"
22-
path = "uniffi-bindgen.rs"
23-
2420
[profile.release-smaller]
2521
inherits = "release"
2622
opt-level = 'z' # Optimize for size.
@@ -83,7 +79,7 @@ proptest = "1.0.0"
8379
regex = "1.5.6"
8480

8581
[build-dependencies]
86-
uniffi = { version = "0.23.0", features = ["build", "cli"], optional = true }
82+
uniffi = { version = "0.23.0", features = ["build"], optional = true }
8783

8884
[profile.release]
8985
panic = "abort"

bindings/kotlin/ldk-node-jvm/lib/src/test/kotlin/org/lightningdevkit/ldknode/LibraryTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class LibraryTest {
205205
else -> return
206206
}
207207

208-
val invoice = node2.receivePayment(1000000u, "asdf", 9217u)
208+
val invoice = node2.receivePayment(2500000u, "asdf", 9217u)
209209

210210
node1.sendPayment(invoice)
211211

@@ -245,7 +245,7 @@ class LibraryTest {
245245
println("Spendable balance 2 after close: $spendableBalance2AfterClose")
246246
assert(spendableBalance1AfterClose > 95000u)
247247
assert(spendableBalance1AfterClose < 100000u)
248-
assertEquals(101000uL, spendableBalance2AfterClose)
248+
assertEquals(102500uL, spendableBalance2AfterClose)
249249

250250
node1.stop()
251251
node2.stop()

bindings/uniffi-bindgen/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "uniffi-bindgen"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
uniffi = { version = "0.23.0", features = ["cli"] }
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
fn main() {
2-
#[cfg(feature = "uniffi/cli")]
32
uniffi::uniffi_bindgen_main()
43
}

scripts/uniffi_bindgen_generate_kotlin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ BINDINGS_DIR="bindings/kotlin"
33
TARGET_DIR="target/bindings/kotlin"
44
PROJECT_DIR="ldk-node-jvm"
55
PACKAGE_DIR="org/lightningdevkit/ldknode"
6-
UNIFFI_BINDGEN_BIN="cargo run --features=uniffi/cli --bin uniffi-bindgen"
6+
UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml"
77

88
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
99
rustup target add x86_64-unknown-linux-gnu || exit 1

scripts/uniffi_bindgen_generate_kotlin_android.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ BINDINGS_DIR="bindings/kotlin"
33
TARGET_DIR="target"
44
PROJECT_DIR="ldk-node-android"
55
PACKAGE_DIR="org/lightningdevkit/ldknode"
6-
UNIFFI_BINDGEN_BIN="cargo run --features=uniffi/cli --bin uniffi-bindgen"
6+
UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml"
77
ANDROID_NDK_ROOT="/opt/homebrew/share/android-ndk"
88
LLVM_ARCH_PATH="darwin-x86_64"
99
PATH="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$LLVM_ARCH_PATH/bin:$PATH"

scripts/uniffi_bindgen_generate_python.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
BINDINGS_DIR="./bindings/python"
3-
UNIFFI_BINDGEN_BIN="cargo run --features=uniffi/cli --bin uniffi-bindgen"
3+
UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml"
44

55
cargo build --release --features uniffi || exit 1
66
$UNIFFI_BINDGEN_BIN generate bindings/ldk_node.udl --language python -o "$BINDINGS_DIR" || exit 1

scripts/uniffi_bindgen_generate_swift.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
BINDINGS_DIR="./bindings/swift"
3-
UNIFFI_BINDGEN_BIN="cargo run --features=uniffi/cli --bin uniffi-bindgen"
3+
UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml"
44

55
cargo build --release || exit 1
66
$UNIFFI_BINDGEN_BIN generate bindings/ldk_node.udl --language swift -o "$BINDINGS_DIR" || exit 1

0 commit comments

Comments
 (0)