travis: Add build of the Android app

This commit is contained in:
Tobias Brunner 2020-05-14 18:14:59 +02:00
parent eadba6d225
commit 763f07c531
2 changed files with 42 additions and 0 deletions

View File

@ -55,6 +55,34 @@ jobs:
- env: TEST=osx
compiler: clang
os: osx
- env: TEST=android
install:
# see https://developer.android.com/studio#command-tools
- export ANDROID_TOOLS=commandlinetools-linux-6200805_latest.zip
- export ANDROID_HOME=$HOME/android-sdk
- wget -nv https://dl.google.com/android/repository/$ANDROID_TOOLS
- unzip -q $ANDROID_TOOLS -d $ANDROID_HOME && rm $ANDROID_TOOLS
- export PATH=$PATH:$ANDROID_HOME/tools/bin
# sdkmanager only works with Java 8
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
- yes | sdkmanager --sdk_root=$ANDROID_HOME --licenses >/dev/null
- yes | sdkmanager --sdk_root=$ANDROID_HOME --install 'ndk;20.0.5594570'
- mkdir -p $HOME/.gradle
- echo "org.gradle.daemon=false" >> $HOME/.gradle/gradle.properties
- echo "org.gradle.console=plain" >> $HOME/.gradle/gradle.properties
# since the NDK is newly installed everytime, we have to use this to avoid cache misses
- export CCACHE_COMPILERCHECK=content
after_success:
- cat src/frontends/android/app/build/reports/lint-results.xml
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
ccache: true
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
- env: TEST=all
- env: TEST=all
compiler: clang

View File

@ -205,6 +205,14 @@ win*)
;;
esac
;;
android)
DEPS="$DEPS openjdk-8-jdk"
if test "$1" = "deps"; then
git clone git://git.strongswan.org/android-ndk-boringssl.git -b ndk-static \
src/frontends/android/app/src/main/jni/openssl
fi
TARGET=distdir
;;
osx)
# this causes a false positive in ip-packet.c since Xcode 8.3
CFLAGS="$CFLAGS -Wno-address-of-packed-member"
@ -449,6 +457,12 @@ sonarcloud)
-Dsonar.cfamily.build-wrapper-output=bw-output || exit $?
rm -r bw-output .scannerwork
;;
android)
rm -r strongswan-*
cd src/frontends/android
echo "$ ./gradlew build"
NDK_CCACHE=ccache ./gradlew build
;;
*)
;;
esac