Skip to content

Commit 257bffb

Browse files
committed
Fix bindings generation
Previously, we migrated to the cargo resolver 2, leading to `cli` feature not being available in the 'regular' dependency. Here we fix the build of `uniffi-bindgen` by moving the tool into its own binary crate.
1 parent 3f997aa commit 257bffb

File tree

7 files changed

+14
-10
lines changed

7 files changed

+14
-10
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/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)