Skip to content

Commit 7563720

Browse files
committed
CI: add Android APK build script
1 parent ebfb10c commit 7563720

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

ci/test/00_setup_env_android.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright (c) 2019-2020 The Bitcoin Core developers
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
6+
7+
export LC_ALL=C.UTF-8
8+
9+
export CONTAINER_NAME=ci_android
10+
export PACKAGES="clang llvm unzip openjdk-8-jdk gradle"
11+
12+
export ANDROID_API_LEVEL=28
13+
export ANDROID_BUILD_TOOLS_VERSION=28.0.3
14+
export ANDROID_NDK_VERSION=21.1.6352462
15+
export ANDROID_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
16+
17+
export BITCOIN_CONFIG="--disable-ccache"

ci/test/05_before_script.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ if [ -n "$XCODE_VERSION" ] && [ ! -f "$OSX_SDK_PATH" ]; then
2222
DOCKER_EXEC curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
2323
fi
2424

25+
if [ -n "$ANDROID_TOOLS_URL" ]; then
26+
ANDROID_TOOLS_PATH=$DEPENDS_DIR/sdk-sources/android-tools.zip
27+
ANDROID_HOME="$DEPENDS_DIR"/SDKs/android
28+
ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}
29+
30+
DOCKER_EXEC curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH"
31+
DOCKER_EXEC mkdir -p "${ANDROID_HOME}/cmdline-tools"
32+
DOCKER_EXEC unzip -o "$ANDROID_TOOLS_PATH" -d "${ANDROID_HOME}/cmdline-tools"
33+
DOCKER_EXEC "yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager --install \"build-tools;${ANDROID_BUILD_TOOLS_VERSION}\" \"platform-tools\" \"platforms;android-${ANDROID_API_LEVEL}\" \"ndk;${ANDROID_NDK_VERSION}\""
34+
35+
MAKE_COMMAND="ANDROID_SDK=${ANDROID_HOME} ANDROID_NDK=${ANDROID_NDK_HOME} make $MAKEJOBS -C depends HOST=aarch64-linux-android ANDROID_API_LEVEL=${ANDROID_API_LEVEL} ANDROID_TOOLCHAIN_BIN=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin/ $DEP_OPTS"
36+
DOCKER_EXEC "$MAKE_COMMAND" HOST=aarch64-linux-android
37+
fi
38+
2539
if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
2640
# Use BDB compiled using install_db4.sh script to work around linking issue when using BDB
2741
# from depends. See https://github.com/bitcoin/bitcoin/pull/18288#discussion_r433189350 for

ci/test/06_script_a.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
export LC_ALL=C.UTF-8
88

9+
if [ -n "$ANDROID_TOOLS_URL" ]; then
10+
DOCKER_EXEC make distclean || true
11+
DOCKER_EXEC ./autogen.sh
12+
DOCKER_EXEC ./configure $BITCOIN_CONFIG --prefix=$DEPENDS_DIR/aarch64-linux-android || ( (DOCKER_EXEC cat config.log) && false)
13+
DOCKER_EXEC "cd src/qt && make $MAKEJOBS && ANDROID_HOME=${ANDROID_HOME} ANDROID_NDK_HOME=${ANDROID_NDK_HOME} make apk"
14+
exit 0
15+
fi
16+
917
BITCOIN_CONFIG_ALL="--enable-suppress-external-warnings --disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib"
1018
if [ -z "$NO_WERROR" ]; then
1119
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror"

0 commit comments

Comments
 (0)