commit d871963f6fe2287fce7632980e484f3d66a2fe98
parent 5a4fdd1e6486295dae34059f6c691686f718c93f
Author: Darren Clarke <darren@redaranj.com>
Date: Wed, 8 Nov 2023 23:02:17 +0100
More Android build updates
Diffstat:
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/mobile/android/.gitlab-ci.yml b/mobile/android/.gitlab-ci.yml
@@ -17,15 +17,15 @@ before_script:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- source $HOME/.cargo/env
- rustup override set $RUST_VERSION
- - cargo install cross
+ - cargo install cross --git https://github.com/cross-rs/cross
build_android:
stage: build
script:
- - pwd
- - which bash
- chmod +x ./mobile/android/build.sh
- /bin/bash ./mobile/android/build.sh
+ variables:
+ CROSS_CONTAINER_IN_CONTAINER: "true"
artifacts:
paths:
- - ./out/
+ - ./mobile/android/out/
diff --git a/mobile/android/build.sh b/mobile/android/build.sh
@@ -2,7 +2,7 @@
MOBILE_DIR="$(pwd)/mobile"
ANDROID_DIR="${MOBILE_DIR}/android"
-TARGET_DIR="${ANDROID_DIR}/target"
+TARGET_DIR="${MOBILE_DIR}/target"
OUT_DIR="${ANDROID_DIR}/out"
BINDINGS_DIR="${MOBILE_DIR}/bindings"
JNILIBS_DIR="${OUT_DIR}/jniLibs"
@@ -12,30 +12,27 @@ LIB_NAME="lib${NAME}.so"
FIXED_LIB_NAME="libuniffi_${NAME}.so"
# build the bindings
-cargo build --manifest-path "${MOBILE_DIR}/Cargo.toml" --target-dir="${TARGET_DIR}"
-mkdir -p ${OUT_DIR}
-cp -r ${BINDINGS_DIR}/uniffi ${OUT_DIR}/
+cargo build --manifest-path "${MOBILE_DIR}/Cargo.toml"
+mkdir -p ${OUT_DIR}/java
+cp -r ${BINDINGS_DIR}/uniffi ${OUT_DIR}/java/
# build the libraries
declare -A arch_dir_map=(
- ["x86_64-linux-android"]="x86_64" #,
-# ["i686-linux-android"]="x86",
-# ["armv7-linux-androideabi"]="armeabi-v7a",
-# ["aarch64-linux-android"]="arm64-v8a"
+ ["x86_64-linux-android"]="x86_64"
+ ["i686-linux-android"]="x86"
+ ["armv7-linux-androideabi"]="armeabi-v7a"
+ ["aarch64-linux-android"]="arm64-v8a"
)
for architecture in "${!arch_dir_map[@]}"; do
- ARCH_TARGET_DIR="${TARGET_DIR}/${architecture}"
- echo ${ARCH_TARGET_DIR}
- echo ${MOBILE_DIR}
if [ "${BUILD_MODE}" == "release" ]; then
- cross build --manifest-path "${MOBILE_DIR}/Cargo.toml" --target "$architecture" --target-dir="${ARCH_TARGET_DIR}" --release
+ cross build --release --manifest-path "${MOBILE_DIR}/Cargo.toml" --target "$architecture"
else
- cross build --manifest-path "${MOBILE_DIR}/Cargo.toml" --target "$architecture" --target-dir="${ARCH_TARGET_DIR}"
+ cross build --manifest-path "${MOBILE_DIR}/Cargo.toml" --target "$architecture"
fi
DESTINATION_DIR="${JNILIBS_DIR}/${arch_dir_map[$architecture]}"
mkdir -p ${DESTINATION_DIR}
- cp "${ARCH_TARGET_DIR}/${BUILD_MODE}/${LIB_NAME}" "${DESTINATION_DIR}/${FIXED_LIB_NAME}"
+ cp "${TARGET_DIR}/${architecture}/${BUILD_MODE}/${LIB_NAME}" "${DESTINATION_DIR}/${FIXED_LIB_NAME}"
done