build: migrate uniffi bindings files generation to library mode
This commit is contained in:
parent
5557bb94ea
commit
330dc96b8a
@ -123,14 +123,14 @@ internal class UniFfiAndroidPlugin : Plugin<Project> {
|
|||||||
val generateAndroidBindings by tasks.register<Exec>("generateAndroidBindings") {
|
val generateAndroidBindings by tasks.register<Exec>("generateAndroidBindings") {
|
||||||
dependsOn(moveNativeAndroidLibs)
|
dependsOn(moveNativeAndroidLibs)
|
||||||
|
|
||||||
// val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so"
|
val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so"
|
||||||
// workingDir("${project.projectDir}/../../bdk-ffi")
|
workingDir("${project.projectDir}/../../bdk-ffi")
|
||||||
// val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")
|
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")
|
||||||
|
|
||||||
// The code above worked for uniffi 0.24.3 using the --library flag
|
// The code above worked for uniffi 0.24.3 using the --library flag
|
||||||
// The code below works for uniffi 0.23.0
|
// The code below works for uniffi 0.23.0
|
||||||
workingDir("${project.projectDir}/../../bdk-ffi")
|
// workingDir("${project.projectDir}/../../bdk-ffi")
|
||||||
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--config", "uniffi-android.toml", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")
|
// val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--config", "uniffi-android.toml", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format")
|
||||||
|
|
||||||
executable("cargo")
|
executable("cargo")
|
||||||
args(cargoArgs)
|
args(cargoArgs)
|
||||||
|
@ -112,20 +112,20 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
// TODO 2: Is the Windows name the correct one?
|
// TODO 2: Is the Windows name the correct one?
|
||||||
// TODO 3: This will not work on mac Intel (x86_64 architecture)
|
// TODO 3: This will not work on mac Intel (x86_64 architecture)
|
||||||
// val libraryPath = when (operatingSystem) {
|
val libraryPath = when (operatingSystem) {
|
||||||
// OS.LINUX -> "./target/x86_64-unknown-linux-gnu/release-smaller/libbdkffi.so"
|
OS.LINUX -> "./target/x86_64-unknown-linux-gnu/release-smaller/libbdkffi.so"
|
||||||
// OS.MAC -> "./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib"
|
OS.MAC -> "./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib"
|
||||||
// OS.WINDOWS -> "./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll"
|
OS.WINDOWS -> "./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll"
|
||||||
// else -> throw Exception("Unsupported OS")
|
else -> throw Exception("Unsupported OS")
|
||||||
// }
|
}
|
||||||
|
|
||||||
// workingDir("${project.projectDir}/../../bdk-ffi/")
|
workingDir("${project.projectDir}/../../bdk-ffi/")
|
||||||
// val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin/", "--no-format")
|
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin/", "--no-format")
|
||||||
|
|
||||||
// The code above was for the migration to uniffi 0.24.3 using the --library flag
|
// The code above was for the migration to uniffi 0.24.3 using the --library flag
|
||||||
// The code below works with uniffi 0.23.0
|
// The code below works with uniffi 0.23.0
|
||||||
workingDir("${project.projectDir}/../../bdk-ffi/")
|
// workingDir("${project.projectDir}/../../bdk-ffi/")
|
||||||
val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin", "--no-format")
|
// val cargoArgs: List<String> = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin", "--no-format")
|
||||||
executable("cargo")
|
executable("cargo")
|
||||||
args(cargoArgs)
|
args(cargoArgs)
|
||||||
|
|
||||||
|
@ -4,14 +4,15 @@ set -euo pipefail
|
|||||||
${PYBIN}/python --version
|
${PYBIN}/python --version
|
||||||
${PYBIN}/pip install -r requirements.txt
|
${PYBIN}/pip install -r requirements.txt
|
||||||
|
|
||||||
echo "Generating bdk.py..."
|
|
||||||
cd ../bdk-ffi/
|
cd ../bdk-ffi/
|
||||||
rustup default 1.77.1
|
rustup default 1.77.1
|
||||||
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
|
||||||
|
|
||||||
echo "Generating native binaries..."
|
echo "Generating native binaries..."
|
||||||
cargo build --profile release-smaller
|
cargo build --profile release-smaller
|
||||||
|
|
||||||
|
echo "Generating bdk.py..."
|
||||||
|
cargo run --bin uniffi-bindgen generate --library ./target/release-smaller/libbdkffi.so --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
||||||
|
|
||||||
echo "Copying linux libbdkffi.so..."
|
echo "Copying linux libbdkffi.so..."
|
||||||
cp ./target/release-smaller/libbdkffi.so ../bdk-python/src/bdkpython/libbdkffi.so
|
cp ./target/release-smaller/libbdkffi.so ../bdk-python/src/bdkpython/libbdkffi.so
|
||||||
|
|
||||||
|
@ -4,15 +4,16 @@ set -euo pipefail
|
|||||||
python3 --version
|
python3 --version
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
echo "Generating bdk.py..."
|
|
||||||
cd ../bdk-ffi/
|
cd ../bdk-ffi/
|
||||||
rustup default 1.77.1
|
rustup default 1.77.1
|
||||||
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
rustup target add aarch64-apple-darwin
|
||||||
|
|
||||||
echo "Generating native binaries..."
|
echo "Generating native binaries..."
|
||||||
rustup target add aarch64-apple-darwin
|
|
||||||
cargo build --profile release-smaller --target aarch64-apple-darwin
|
cargo build --profile release-smaller --target aarch64-apple-darwin
|
||||||
|
|
||||||
|
echo "Generating bdk.py..."
|
||||||
|
cargo run --bin uniffi-bindgen generate --library ./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
||||||
|
|
||||||
echo "Copying libraries libbdkffi.dylib..."
|
echo "Copying libraries libbdkffi.dylib..."
|
||||||
cp ./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
|
cp ./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
|
||||||
|
|
||||||
|
@ -4,15 +4,16 @@ set -euo pipefail
|
|||||||
python3 --version
|
python3 --version
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
echo "Generating bdk.py..."
|
|
||||||
cd ../bdk-ffi/
|
cd ../bdk-ffi/
|
||||||
rustup default 1.77.1
|
rustup default 1.77.1
|
||||||
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
rustup target add x86_64-apple-darwin
|
||||||
|
|
||||||
echo "Generating native binaries..."
|
echo "Generating native binaries..."
|
||||||
rustup target add x86_64-apple-darwin
|
|
||||||
cargo build --profile release-smaller --target x86_64-apple-darwin
|
cargo build --profile release-smaller --target x86_64-apple-darwin
|
||||||
|
|
||||||
|
echo "Generating bdk.py..."
|
||||||
|
cargo run --bin uniffi-bindgen generate --library ./target/x86_64-apple-darwin/release-smaller/libbdkffi.dylib --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
||||||
|
|
||||||
echo "Copying libraries libbdkffi.dylib..."
|
echo "Copying libraries libbdkffi.dylib..."
|
||||||
cp ./target/x86_64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
|
cp ./target/x86_64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
|
||||||
|
|
||||||
|
@ -4,15 +4,16 @@ set -euo pipefail
|
|||||||
python3 --version
|
python3 --version
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
echo "Generating bdk.py..."
|
|
||||||
cd ../bdk-ffi/
|
cd ../bdk-ffi/
|
||||||
rustup default 1.77.1
|
rustup default 1.77.1
|
||||||
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
rustup target add x86_64-pc-windows-msvc
|
||||||
|
|
||||||
echo "Generating native binaries..."
|
echo "Generating native binaries..."
|
||||||
rustup target add x86_64-pc-windows-msvc
|
|
||||||
cargo build --profile release-smaller --target x86_64-pc-windows-msvc
|
cargo build --profile release-smaller --target x86_64-pc-windows-msvc
|
||||||
|
|
||||||
|
echo "Generating bdk.py..."
|
||||||
|
cargo run --bin uniffi-bindgen generate --library ./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
|
||||||
|
|
||||||
echo "Copying libraries bdkffi.dll..."
|
echo "Copying libraries bdkffi.dll..."
|
||||||
cp ./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll ../bdk-python/src/bdkpython/bdkffi.dll
|
cp ./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll ../bdk-python/src/bdkpython/bdkffi.dll
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ rustup target add aarch64-apple-darwin # mac M1
|
|||||||
rustup target add x86_64-apple-darwin # mac x86_64
|
rustup target add x86_64-apple-darwin # mac x86_64
|
||||||
|
|
||||||
cd ../bdk-ffi/ || exit
|
cd ../bdk-ffi/ || exit
|
||||||
cargo run --bin uniffi-bindgen generate src/bdk.udl --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format
|
|
||||||
|
|
||||||
cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin
|
cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin
|
||||||
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin
|
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin
|
||||||
@ -20,6 +19,8 @@ cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-io
|
|||||||
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios
|
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios
|
||||||
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios-sim
|
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios-sim
|
||||||
|
|
||||||
|
cargo run --bin uniffi-bindgen generate --library ./target/aarch64-apple-ios/release-smaller/libbdkffi.dylib --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format
|
||||||
|
|
||||||
mkdir -p target/lipo-ios-sim/release-smaller
|
mkdir -p target/lipo-ios-sim/release-smaller
|
||||||
lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a
|
lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a
|
||||||
mkdir -p target/lipo-macos/release-smaller
|
mkdir -p target/lipo-macos/release-smaller
|
||||||
|
Loading…
x
Reference in New Issue
Block a user