blob: a4827e46ee79d6f70e53eaeb69c1f601ca245231 [file] [log] [blame]
Adrien Béraud04d822c2015-04-02 17:44:36 -04001#! /bin/bash
Adrien Béraud86759bb2016-09-28 13:54:54 -04002# Build Ring daemon and client APK for Android
Alexandre Lision43b9aeb2014-07-15 14:21:19 -04003
4if [ -z "$ANDROID_ABI" ]; then
Adrien Béraudd088a982017-02-09 14:38:36 -05005 ANDROID_ABI="armeabi-v7a arm64-v8a x86 x86_64"
Adrien Béraud86759bb2016-09-28 13:54:54 -04006 echo "ANDROID_ABI not provided, building for ${ANDROID_ABI}"
Alexandre Lision43b9aeb2014-07-15 14:21:19 -04007fi
8
Alexandre Lision6b792f02017-08-05 14:06:56 -04009TOP=$(pwd)/ring-android
10
Alexandre Lision9db308d2016-11-26 18:43:27 -050011# Flags:
12
13 # --release: build in release mode
14 # --daemon: Only build the daemon for the selected archs
15
Romain Bertozzi32692de2016-10-27 15:16:46 -040016RELEASE=0
Alexandre Lision9db308d2016-11-26 18:43:27 -050017DAEMON_ONLY=0
Romain Bertozzi32692de2016-10-27 15:16:46 -040018for i in ${@}; do
19 case "$i" in
20 release|--release)
21 RELEASE=1
22 ;;
Alexandre Lision9db308d2016-11-26 18:43:27 -050023 daemon|--daemon)
24 DAEMON_ONLY=1
25 ;;
Romain Bertozzi32692de2016-10-27 15:16:46 -040026 *)
27 ;;
28 esac
29done
30export RELEASE
Aline Bonnetaded8f22017-03-22 11:22:35 -040031export DAEMON_ONLY
Romain Bertozzi32692de2016-10-27 15:16:46 -040032
Adrien Béraud86759bb2016-09-28 13:54:54 -040033ANDROID_ABI_LIST="${ANDROID_ABI}"
34echo "Building ABIs: ${ANDROID_ABI_LIST}"
35for i in ${ANDROID_ABI_LIST}; do
36 echo "$i starts building"
37 ANDROID_NDK=$ANDROID_NDK ANDROID_SDK=$ANDROID_SDK ANDROID_ABI=$i \
Romain Bertozzi32692de2016-10-27 15:16:46 -040038 ./build-daemon.sh $* || { echo "$i build KO"; exit 1; }
Adrien Béraud86759bb2016-09-28 13:54:54 -040039 echo "$i build OK"
Alexandre Lision7d5df5d2014-10-27 13:10:01 -040040done
Alexandre Lision9db308d2016-11-26 18:43:27 -050041
Adrien Béraud0e0feef2018-02-13 16:32:06 +010042if [ -z "$RING_BUILD_FIREBASE" ]; then
43 echo "Building without Firebase support"
44else
45 GRADLE_PROPERTIES="-PbuildFirebase"
46 echo "Building with Firebase support"
47fi
Alexandre Lision9db308d2016-11-26 18:43:27 -050048if [[ $DAEMON_ONLY -eq 0 ]]; then
Alexandre Lision6b792f02017-08-05 14:06:56 -040049 if [[ $RELEASE -eq 1 ]]; then
Adrien Béraud0e0feef2018-02-13 16:32:06 +010050 cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleRelease
Alexandre Lision6b792f02017-08-05 14:06:56 -040051 else
Adrien Béraud0e0feef2018-02-13 16:32:06 +010052 cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleDebug
Alexandre Lision6b792f02017-08-05 14:06:56 -040053 fi
Alexandre Lision9db308d2016-11-26 18:43:27 -050054fi