Add android aar build and connected device test
This commit is contained in:
parent
ee59dbe543
commit
fe251c12f3
15
build.sh
15
build.sh
@ -49,6 +49,8 @@ build_kotlin() {
|
|||||||
|
|
||||||
## rust android
|
## rust android
|
||||||
build_android() {
|
build_android() {
|
||||||
|
build_kotlin
|
||||||
|
|
||||||
# If ANDROID_NDK_HOME is not set then set it to github actions default
|
# If ANDROID_NDK_HOME is not set then set it to github actions default
|
||||||
[ -z "$ANDROID_NDK_HOME" ] && export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
|
[ -z "$ANDROID_NDK_HOME" ] && export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle
|
||||||
|
|
||||||
@ -61,27 +63,27 @@ build_android() {
|
|||||||
# IMPORTANT: make sure every target is not a substring of a different one. We check for them with grep later on
|
# IMPORTANT: make sure every target is not a substring of a different one. We check for them with grep later on
|
||||||
BUILD_TARGETS="${BUILD_TARGETS:-aarch64,armv7,x86_64,i686}"
|
BUILD_TARGETS="${BUILD_TARGETS:-aarch64,armv7,x86_64,i686}"
|
||||||
|
|
||||||
mkdir -p bdk-kotlin/android/src/main/jniLibs/ bdk-kotlin/android/src/main/jniLibs/arm64-v8a bdk-kotlin/android/src/main/jniLibs/x86_64 bdk-kotlin/android/src/main/jniLibs/armeabi-v7a bdk-kotlin/android/src/main/jniLibs/x86
|
mkdir -p bindings/bdk-kotlin/android/src/main/jniLibs/ bindings/bdk-kotlin/android/src/main/jniLibs/arm64-v8a bindings/bdk-kotlin/android/src/main/jniLibs/x86_64 bindings/bdk-kotlin/android/src/main/jniLibs/armeabi-v7a bindings/bdk-kotlin/android/src/main/jniLibs/x86
|
||||||
|
|
||||||
if echo $BUILD_TARGETS | grep "aarch64"; then
|
if echo $BUILD_TARGETS | grep "aarch64"; then
|
||||||
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="aarch64-linux-android21-clang" CC="aarch64-linux-android21-clang" cargo build --target=aarch64-linux-android
|
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="aarch64-linux-android21-clang" CC="aarch64-linux-android21-clang" cargo build --target=aarch64-linux-android
|
||||||
cp target/aarch64-linux-android/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/arm64-v8a
|
cp target/aarch64-linux-android/debug/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/arm64-v8a
|
||||||
fi
|
fi
|
||||||
if echo $BUILD_TARGETS | grep "x86_64"; then
|
if echo $BUILD_TARGETS | grep "x86_64"; then
|
||||||
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="x86_64-linux-android21-clang" CC="x86_64-linux-android21-clang" cargo build --target=x86_64-linux-android
|
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="x86_64-linux-android21-clang" CC="x86_64-linux-android21-clang" cargo build --target=x86_64-linux-android
|
||||||
cp target/x86_64-linux-android/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/x86_64
|
cp target/x86_64-linux-android/debug/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/x86_64
|
||||||
fi
|
fi
|
||||||
if echo $BUILD_TARGETS | grep "armv7"; then
|
if echo $BUILD_TARGETS | grep "armv7"; then
|
||||||
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="armv7a-linux-androideabi21-clang" CC="armv7a-linux-androideabi21-clang" cargo build --target=armv7-linux-androideabi
|
CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="armv7a-linux-androideabi21-clang" CC="armv7a-linux-androideabi21-clang" cargo build --target=armv7-linux-androideabi
|
||||||
cp target/armv7-linux-androideabi/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/armeabi-v7a
|
cp target/armv7-linux-androideabi/debug/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/armeabi-v7a
|
||||||
fi
|
fi
|
||||||
if echo $BUILD_TARGETS | grep "i686"; then
|
if echo $BUILD_TARGETS | grep "i686"; then
|
||||||
CARGO_TARGET_I686_LINUX_ANDROID_LINKER="i686-linux-android21-clang" CC="i686-linux-android21-clang" cargo build --target=i686-linux-android
|
CARGO_TARGET_I686_LINUX_ANDROID_LINKER="i686-linux-android21-clang" CC="i686-linux-android21-clang" cargo build --target=i686-linux-android
|
||||||
cp target/i686-linux-android/debug/libbdk_ffi.so bdk-kotlin/android/src/main/jniLibs/x86
|
cp target/i686-linux-android/debug/libuniffi_bdk.so bindings/bdk-kotlin/android/src/main/jniLibs/x86
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bdk-kotlin aar
|
# bdk-kotlin aar
|
||||||
(cd bdk-kotlin && ./gradlew :android:build && ./gradlew :android:publishToMavenLocal)
|
(cd bindings/bdk-kotlin && ./gradlew :android:build && ./gradlew :android:publishToMavenLocal)
|
||||||
}
|
}
|
||||||
|
|
||||||
OS=$(uname)
|
OS=$(uname)
|
||||||
@ -95,6 +97,7 @@ else
|
|||||||
|
|
||||||
while [ -n "$1" ]; do # while loop starts
|
while [ -n "$1" ]; do # while loop starts
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-a) build_android ;;
|
||||||
-k) build_kotlin ;;
|
-k) build_kotlin ;;
|
||||||
-h) help ;;
|
-h) help ;;
|
||||||
*) echo "Option $1 not recognized" ;;
|
*) echo "Option $1 not recognized" ;;
|
||||||
|
8
test.sh
8
test.sh
@ -11,13 +11,18 @@ help()
|
|||||||
echo
|
echo
|
||||||
echo "Syntax: build [-a|h|k|v]"
|
echo "Syntax: build [-a|h|k|v]"
|
||||||
echo "options:"
|
echo "options:"
|
||||||
|
echo "-a Android connected device tests."
|
||||||
echo "-h Print this Help."
|
echo "-h Print this Help."
|
||||||
echo "-k Kotlin tests."
|
echo "-k Kotlin tests."
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
test_kotlin() {
|
test_kotlin() {
|
||||||
(cd bindings/bdk-kotlin && rm -rf /tmp/testdb && ./gradlew test -Djna.debug_load=true)
|
(cd bindings/bdk-kotlin && ./gradlew :jvm:test -Djna.debug_load=true)
|
||||||
|
}
|
||||||
|
|
||||||
|
test_android() {
|
||||||
|
(cd bindings/bdk-kotlin && ./gradlew :android:connectedDebugAndroidTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $1 = "-h" ]
|
if [ $1 = "-h" ]
|
||||||
@ -29,6 +34,7 @@ else
|
|||||||
# optional tests
|
# optional tests
|
||||||
while [ -n "$1" ]; do # while loop starts
|
while [ -n "$1" ]; do # while loop starts
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-a) test_android ;;
|
||||||
-h) help ;;
|
-h) help ;;
|
||||||
-k) test_kotlin ;;
|
-k) test_kotlin ;;
|
||||||
*) echo "Option $1 not recognized" ;;
|
*) echo "Option $1 not recognized" ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user