Build(perf): reuse existing ndk if available

This commit is contained in:
Mathias-Boulay 2024-04-16 09:02:42 +02:00
parent 2b3eda724c
commit a0db676d65
5 changed files with 28 additions and 24 deletions

View File

@ -32,7 +32,18 @@ RUN apt-get install -y \
# JDK 17
RUN apt-get install -y openjdk-17-jdk
WORKDIR /home
# NDK install
ENV NDK_VERSION r25c
ENV ANDROID_NDK_HOME /home/android-ndk-$NDK_VERSION
RUN \
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip" \
&& unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip \
&& rm android-ndk-$NDK_VERSION-linux-x86_64.zip
COPY . .

View File

@ -5,9 +5,14 @@ set -e
export JDK_DEBUG_LEVEL=release
if [[ "$BUILD_IOS" != "1" ]]; then
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip"
./extractndk.sh
./maketoolchain.sh
if [[ -d "$ANDROID_NDK_HOME" ]]; then
echo "NDK already exists: $ANDROID_NDK_HOME"
else
echo "Downloading NDK"
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip"
unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip
fi
cp devkit.info.${TARGET_SHORT} ${TOOLCHAIN}
else
chmod +x ios-arm64-clang
chmod +x ios-arm64-clang++

View File

@ -1,2 +0,0 @@
#!/bin/sh
unzip -q android-ndk-$NDK_VERSION-linux-x86_64.zip

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -e
. setdevkitpath.sh
# No need since all toolchains are standalone
# $NDK/build/tools/make_standalone_toolchain.py \
# --arch=${TARGET_SHORT} \
# --api=21 \
# --install-dir=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain
cp devkit.info.${TARGET_SHORT} ${TOOLCHAIN}

View File

@ -44,19 +44,21 @@ if [[ "$BUILD_IOS" == "1" ]]; then
else
export JVM_PLATFORM=linux
# Set NDK
export API=21
export NDK=$PWD/android-ndk-$NDK_VERSION
export ANDROID_NDK_ROOT=$NDK
#export TOOLCHAIN=$NDK/generated-toolchains/android-${TARGET_SHORT}-toolchain
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
# Runners usually ship with a recent NDK already
if [[ -z "$ANDROID_NDK_HOME" ]]
then
export ANDROID_NDK_HOME=$PWD/android-ndk-$NDK_VERSION
fi
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64
export ANDROID_INCLUDE=$TOOLCHAIN/sysroot/usr/include
# If I'm right it should only need the dummy libs
export CPPFLAGS="-I$ANDROID_INCLUDE -I$ANDROID_INCLUDE/$TARGET" # -I/usr/include -I/usr/lib
#export LDFLAGS="-L$NDK/platforms/android-$API/arch-$TARGET_SHORT/usr/lib"
export CPPFLAGS=""
export LDFLAGS=""