Adrien Béraud | 04d822c | 2015-04-02 17:44:36 -0400 | [diff] [blame] | 1 | #! /bin/bash |
Adrien Béraud | 86759bb | 2016-09-28 13:54:54 -0400 | [diff] [blame] | 2 | # Build Ring daemon and client APK for Android |
Alexandre Lision | 43b9aeb | 2014-07-15 14:21:19 -0400 | [diff] [blame] | 3 | |
| 4 | if [ -z "$ANDROID_ABI" ]; then |
Adrien Béraud | d088a98 | 2017-02-09 14:38:36 -0500 | [diff] [blame] | 5 | ANDROID_ABI="armeabi-v7a arm64-v8a x86 x86_64" |
Adrien Béraud | 86759bb | 2016-09-28 13:54:54 -0400 | [diff] [blame] | 6 | echo "ANDROID_ABI not provided, building for ${ANDROID_ABI}" |
Alexandre Lision | 43b9aeb | 2014-07-15 14:21:19 -0400 | [diff] [blame] | 7 | fi |
| 8 | |
Alexandre Lision | 6b792f0 | 2017-08-05 14:06:56 -0400 | [diff] [blame] | 9 | TOP=$(pwd)/ring-android |
| 10 | |
Alexandre Lision | 9db308d | 2016-11-26 18:43:27 -0500 | [diff] [blame] | 11 | # Flags: |
| 12 | |
| 13 | # --release: build in release mode |
| 14 | # --daemon: Only build the daemon for the selected archs |
| 15 | |
Romain Bertozzi | 32692de | 2016-10-27 15:16:46 -0400 | [diff] [blame] | 16 | RELEASE=0 |
Alexandre Lision | 9db308d | 2016-11-26 18:43:27 -0500 | [diff] [blame] | 17 | DAEMON_ONLY=0 |
Romain Bertozzi | 32692de | 2016-10-27 15:16:46 -0400 | [diff] [blame] | 18 | for i in ${@}; do |
| 19 | case "$i" in |
| 20 | release|--release) |
| 21 | RELEASE=1 |
| 22 | ;; |
Alexandre Lision | 9db308d | 2016-11-26 18:43:27 -0500 | [diff] [blame] | 23 | daemon|--daemon) |
| 24 | DAEMON_ONLY=1 |
| 25 | ;; |
Romain Bertozzi | 32692de | 2016-10-27 15:16:46 -0400 | [diff] [blame] | 26 | *) |
| 27 | ;; |
| 28 | esac |
| 29 | done |
| 30 | export RELEASE |
Aline Bonnet | aded8f2 | 2017-03-22 11:22:35 -0400 | [diff] [blame] | 31 | export DAEMON_ONLY |
Romain Bertozzi | 32692de | 2016-10-27 15:16:46 -0400 | [diff] [blame] | 32 | |
Adrien Béraud | 86759bb | 2016-09-28 13:54:54 -0400 | [diff] [blame] | 33 | ANDROID_ABI_LIST="${ANDROID_ABI}" |
| 34 | echo "Building ABIs: ${ANDROID_ABI_LIST}" |
| 35 | for i in ${ANDROID_ABI_LIST}; do |
| 36 | echo "$i starts building" |
| 37 | ANDROID_NDK=$ANDROID_NDK ANDROID_SDK=$ANDROID_SDK ANDROID_ABI=$i \ |
Romain Bertozzi | 32692de | 2016-10-27 15:16:46 -0400 | [diff] [blame] | 38 | ./build-daemon.sh $* || { echo "$i build KO"; exit 1; } |
Adrien Béraud | 86759bb | 2016-09-28 13:54:54 -0400 | [diff] [blame] | 39 | echo "$i build OK" |
Alexandre Lision | 7d5df5d | 2014-10-27 13:10:01 -0400 | [diff] [blame] | 40 | done |
Alexandre Lision | 9db308d | 2016-11-26 18:43:27 -0500 | [diff] [blame] | 41 | |
Adrien Béraud | 0e0feef | 2018-02-13 16:32:06 +0100 | [diff] [blame] | 42 | if [ -z "$RING_BUILD_FIREBASE" ]; then |
| 43 | echo "Building without Firebase support" |
| 44 | else |
| 45 | GRADLE_PROPERTIES="-PbuildFirebase" |
| 46 | echo "Building with Firebase support" |
| 47 | fi |
Alexandre Lision | 9db308d | 2016-11-26 18:43:27 -0500 | [diff] [blame] | 48 | if [[ $DAEMON_ONLY -eq 0 ]]; then |
Alexandre Lision | 6b792f0 | 2017-08-05 14:06:56 -0400 | [diff] [blame] | 49 | if [[ $RELEASE -eq 1 ]]; then |
Adrien Béraud | 0e0feef | 2018-02-13 16:32:06 +0100 | [diff] [blame] | 50 | cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleRelease |
Alexandre Lision | 6b792f0 | 2017-08-05 14:06:56 -0400 | [diff] [blame] | 51 | else |
Adrien Béraud | 0e0feef | 2018-02-13 16:32:06 +0100 | [diff] [blame] | 52 | cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleDebug |
Alexandre Lision | 6b792f0 | 2017-08-05 14:06:56 -0400 | [diff] [blame] | 53 | fi |
Alexandre Lision | 9db308d | 2016-11-26 18:43:27 -0500 | [diff] [blame] | 54 | fi |