diff --git a/bdk-android/scripts/dev/build-dev-macos-aarch64.sh b/bdk-android/scripts/dev/build-dev-macos-aarch64.sh index 27fa6870..b9ab334e 100644 --- a/bdk-android/scripts/dev/build-dev-macos-aarch64.sh +++ b/bdk-android/scripts/dev/build-dev-macos-aarch64.sh @@ -25,4 +25,4 @@ mkdir -p ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_ARM64_V8A/ cp ./target/$COMPILATION_TARGET_ARM64_V8A/debug/$LIB_NAME ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_ARM64_V8A/ # Generate Kotlin bindings using uniffi-bindgen -cargo run --locked --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/debug/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/debug/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format diff --git a/bdk-android/scripts/release/build-release-linux-x86_64.sh b/bdk-android/scripts/release/build-release-linux-x86_64.sh index 85d756fb..7ccc2752 100644 --- a/bdk-android/scripts/release/build-release-linux-x86_64.sh +++ b/bdk-android/scripts/release/build-release-linux-x86_64.sh @@ -35,4 +35,4 @@ cp ./target/$COMPILATION_TARGET_ARMEABI_V7A/release-smaller/$LIB_NAME ../bdk-and cp ./target/$COMPILATION_TARGET_X86_64/release-smaller/$LIB_NAME ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_X86_64/ # Generate Kotlin bindings using uniffi-bindgen -cargo run --locked --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/release-smaller/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/release-smaller/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format diff --git a/bdk-android/scripts/release/build-release-macos-aarch64.sh b/bdk-android/scripts/release/build-release-macos-aarch64.sh index 39a73f87..f6136f82 100644 --- a/bdk-android/scripts/release/build-release-macos-aarch64.sh +++ b/bdk-android/scripts/release/build-release-macos-aarch64.sh @@ -35,4 +35,4 @@ cp ./target/$COMPILATION_TARGET_ARMEABI_V7A/release-smaller/$LIB_NAME ../bdk-and cp ./target/$COMPILATION_TARGET_X86_64/release-smaller/$LIB_NAME ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_X86_64/ # Generate Kotlin bindings using uniffi-bindgen -cargo run --locked --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/release-smaller/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/release-smaller/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format diff --git a/bdk-android/scripts/release/build-release-windows-x86_64.sh b/bdk-android/scripts/release/build-release-windows-x86_64.sh index 0fa945a9..0d3c9492 100644 --- a/bdk-android/scripts/release/build-release-windows-x86_64.sh +++ b/bdk-android/scripts/release/build-release-windows-x86_64.sh @@ -36,4 +36,4 @@ cp ./target/$COMPILATION_TARGET_ARMEABI_V7A/release-smaller/$LIB_NAME ../bdk-and cp ./target/$COMPILATION_TARGET_X86_64/release-smaller/$LIB_NAME ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_X86_64/ # Generate Kotlin bindings using uniffi-bindgen. (Any of the other $COMPILATION_TARGET_* could have been used) -cargo run --locked --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/release-smaller/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate --library ./target/$COMPILATION_TARGET_ARM64_V8A/release-smaller/$LIB_NAME --language kotlin --out-dir ../bdk-android/lib/src/main/kotlin/ --no-format diff --git a/bdk-ffi/Cargo.toml b/bdk-ffi/Cargo.toml index c9def479..d0049842 100644 --- a/bdk-ffi/Cargo.toml +++ b/bdk-ffi/Cargo.toml @@ -4,6 +4,7 @@ version = "3.2.0-alpha.0" homepage = "https://bitcoindevkit.org" repository = "https://github.com/bitcoindevkit/bdk" edition = "2018" +resolver = "2" license = "MIT OR Apache-2.0" [lib] @@ -13,6 +14,10 @@ name = "bdkffi" [[bin]] name = "uniffi-bindgen" path = "uniffi-bindgen.rs" +required-features = ["uniffi-bindgen"] + +[features] +uniffi-bindgen = ["uniffi/cli"] [dependencies] bdk_wallet = { version = "=3.2.0", features = ["all-keys", "keys-bip39", "rusqlite"] } @@ -20,7 +25,7 @@ bdk_esplora = { version = "0.22.3", default-features = false, features = ["std", bdk_electrum = { version = "0.24.1", default-features = false, features = ["use-rustls-ring"] } bdk_kyoto = { version = "0.17.1" } -uniffi = { version = "=0.31.2", features = ["cli"]} +uniffi = { version = "=0.31.2"} thiserror = "2.0.17" [build-dependencies] diff --git a/bdk-swift/build-xcframework-dev.sh b/bdk-swift/build-xcframework-dev.sh index 01e5ae8f..3f69309c 100755 --- a/bdk-swift/build-xcframework-dev.sh +++ b/bdk-swift/build-xcframework-dev.sh @@ -35,7 +35,7 @@ cargo build --locked --package bdk-ffi --target "$IOS_SIM_TARGET" cargo build --locked --package bdk-ffi --target "$IOS_DEVICE_TARGET" UNIFFI_LIBRARY_PATH="./target/$IOS_DEVICE_TARGET/$PROFILE_DIR/lib${NAME}.dylib" -cargo run --locked --bin uniffi-bindgen generate \ +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate \ --library "${UNIFFI_LIBRARY_PATH}" \ --language swift \ --out-dir "${SWIFT_OUT_DIR}" \ @@ -49,7 +49,7 @@ cargo run --locked --bin uniffi-bindgen generate \ rm -rf "${NEW_HEADER_DIR:?}"/* rm -rf "${HEADER_OUT_DIR:?}" mkdir -p "${HEADER_OUT_DIR}" -cargo run --locked --bin uniffi-bindgen generate \ +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate \ --library "${UNIFFI_LIBRARY_PATH}" \ --language swift \ --out-dir "${HEADER_OUT_DIR}" \ diff --git a/bdk-swift/build-xcframework.sh b/bdk-swift/build-xcframework.sh index 61ff2f24..f9a803c4 100755 --- a/bdk-swift/build-xcframework.sh +++ b/bdk-swift/build-xcframework.sh @@ -35,7 +35,7 @@ cargo build --locked --package bdk-ffi --profile release-smaller --target aarch6 # build bdk-ffi Swift bindings and put in bdk-swift Sources UNIFFI_LIBRARY_PATH="./target/aarch64-apple-ios/${RELDIR}/lib${NAME}.dylib" -cargo run --locked --bin uniffi-bindgen generate --library "${UNIFFI_LIBRARY_PATH}" --language swift --out-dir "${SWIFT_OUT_DIR}" --no-format +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate --library "${UNIFFI_LIBRARY_PATH}" --language swift --out-dir "${SWIFT_OUT_DIR}" --no-format # Final xcframework structure (per-arch): # Headers/ @@ -45,7 +45,7 @@ cargo run --locked --bin uniffi-bindgen generate --library "${UNIFFI_LIBRARY_PAT rm -rf "${NEW_HEADER_DIR:?}"/* rm -rf "${HEADER_OUT_DIR:?}" mkdir -p "${HEADER_OUT_DIR}" -cargo run --locked --bin uniffi-bindgen generate --library "${UNIFFI_LIBRARY_PATH}" --language swift --out-dir "${HEADER_OUT_DIR}" --no-format +cargo run --locked --features uniffi-bindgen --bin uniffi-bindgen generate --library "${UNIFFI_LIBRARY_PATH}" --language swift --out-dir "${HEADER_OUT_DIR}" --no-format # Keep the header output directory clean: xcframework headers should only contain .h + module.modulemap find "${HEADER_OUT_DIR}" -maxdepth 1 -name '*.swift' -delete