Skip to content

Commit 210947b

Browse files
chore: add development script and commands
1 parent 8149eb3 commit 210947b

File tree

9 files changed

+40
-4
lines changed

9 files changed

+40
-4
lines changed

.github/workflows/android-api-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: "Build Android API documentation"
2828
run: |
2929
cd ./bdk-android/
30-
bash ./scripts/build-linux-x86_64.sh
30+
bash ./scripts/release/build-release-linux-x86_64.sh
3131
./gradlew dokkaHtml
3232
3333
- name: "Upload documentation website"

.github/workflows/publish-android.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
java-version: 17
3434

3535
- name: "Build bdk-android library"
36-
run: bash ./scripts/build-linux-x86_64.sh
36+
run: bash ./scripts/release/build-release-linux-x86_64.sh
3737

3838
- name: "Publish to Maven Central"
3939
env:

.github/workflows/test-android.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: "Build Android library"
4747
run: |
4848
cd bdk-android
49-
bash ./scripts/build-linux-x86_64.sh
49+
bash ./scripts/release/build-release-linux-x86_64.sh
5050
5151
- name: "Enable KVM"
5252
run: |

bdk-android/justfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ publish-local:
2121
[group("Build")]
2222
[doc("Build the library for given ARCH.")]
2323
build ARCH="macos-aarch64":
24-
bash ./scripts/build-{{ARCH}}.sh
24+
bash ./scripts/release/build-release-{{ARCH}}.sh
25+
26+
[group("Build")]
27+
[doc("Build the library for a single architecture in development mode.")]
28+
build-dev:
29+
bash ./scripts/dev/build-dev-macos-aarch64.sh
2530

2631
[group("Build")]
2732
[doc("List available architectures for the build command.")]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
if [ -z "$ANDROID_NDK_ROOT" ]; then
4+
echo "Error: ANDROID_NDK_ROOT is not defined in your environment"
5+
exit 1
6+
fi
7+
8+
PATH="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH"
9+
CFLAGS="-D__ANDROID_MIN_SDK_VERSION__=24"
10+
AR="llvm-ar"
11+
LIB_NAME="libbdkffi.so"
12+
COMPILATION_TARGET_ARM64_V8A="aarch64-linux-android"
13+
RESOURCE_DIR_ARM64_V8A="arm64-v8a"
14+
15+
# Move to the Rust library directory
16+
cd ../bdk-ffi/ || exit
17+
rustup target add $COMPILATION_TARGET_ARM64_V8A
18+
19+
# Build the binaries
20+
# The CC and CARGO_TARGET_<TARGET>_LINUX_ANDROID_LINKER environment variables must be declared on the same line as the cargo build command
21+
CC="aarch64-linux-android24-clang" CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="aarch64-linux-android24-clang" cargo build --target $COMPILATION_TARGET_ARM64_V8A
22+
23+
# Copy the binaries to their respective resource directories
24+
mkdir -p ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_ARM64_V8A/
25+
cp ./target/$COMPILATION_TARGET_ARM64_V8A/debug/$LIB_NAME ../bdk-android/lib/src/main/jniLibs/$RESOURCE_DIR_ARM64_V8A/
26+
27+
# Generate Kotlin bindings using uniffi-bindgen
28+
cargo run --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

bdk-ffi/justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ default:
44
build:
55
cargo build --profile release-smaller
66

7+
build-dev:
8+
cargo build
9+
710
check:
811
cargo fmt
912
cargo clippy

0 commit comments

Comments
 (0)