Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit a0db676

Browse files
Build(perf): reuse existing ndk if available
1 parent 2b3eda7 commit a0db676

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

Dockerfile_port

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@ RUN apt-get install -y \
3232
# JDK 17
3333
RUN apt-get install -y openjdk-17-jdk
3434

35-
3635
WORKDIR /home
3736

37+
38+
# NDK install
39+
ENV NDK_VERSION r25c
40+
ENV ANDROID_NDK_HOME /home/android-ndk-$NDK_VERSION
41+
RUN \
42+
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip" \
43+
&& unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip \
44+
&& rm android-ndk-$NDK_VERSION-linux-x86_64.zip
45+
46+
47+
48+
3849
COPY . .

ci_build_global.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ set -e
55
export JDK_DEBUG_LEVEL=release
66

77
if [[ "$BUILD_IOS" != "1" ]]; then
8-
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip"
9-
./extractndk.sh
10-
./maketoolchain.sh
8+
if [[ -d "$ANDROID_NDK_HOME" ]]; then
9+
echo "NDK already exists: $ANDROID_NDK_HOME"
10+
else
11+
echo "Downloading NDK"
12+
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip"
13+
unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip
14+
fi
15+
cp devkit.info.${TARGET_SHORT} ${TOOLCHAIN}
1116
else
1217
chmod +x ios-arm64-clang
1318
chmod +x ios-arm64-clang++

extractndk.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

maketoolchain.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

setdevkitpath.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,21 @@ if [[ "$BUILD_IOS" == "1" ]]; then
4444
else
4545

4646
export JVM_PLATFORM=linux
47-
# Set NDK
4847
export API=21
49-
export NDK=$PWD/android-ndk-$NDK_VERSION
50-
export ANDROID_NDK_ROOT=$NDK
51-
#export TOOLCHAIN=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain
52-
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
48+
49+
# Runners usually ship with a recent NDK already
50+
if [[ -z "$ANDROID_NDK_HOME" ]]
51+
then
52+
export ANDROID_NDK_HOME=$PWD/android-ndk-$NDK_VERSION
53+
fi
54+
55+
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64
5356

5457
export ANDROID_INCLUDE=$TOOLCHAIN/sysroot/usr/include
5558

5659

5760
# If I'm right it should only need the dummy libs
5861
export CPPFLAGS="-I$ANDROID_INCLUDE -I$ANDROID_INCLUDE/$TARGET" # -I/usr/include -I/usr/lib
59-
#export LDFLAGS="-L$NDK/platforms/android-$API/arch-$TARGET_SHORT/usr/lib"
6062
export CPPFLAGS=""
6163
export LDFLAGS=""
6264

0 commit comments

Comments
 (0)