-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
compile.sh
executable file
·76 lines (69 loc) · 2.08 KB
/
compile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /bin/bash
# Build Jami daemon and client APK for Android
# Flags:
# --test: build in test mode
# --release: build in release mode
# --daemon: Only build the daemon for the selected archs
TEST=0
RELEASE=0
DAEMON_ONLY=0
for i in "${@}"; do
case "$i" in
test|--test)
TEST=1
;;
release|--release)
RELEASE=1
;;
daemon|--daemon)
DAEMON_ONLY=1
;;
*)
;;
esac
done
export RELEASE
if [ -z "$DAEMON_DIR" ]; then
DAEMON_DIR="$(pwd)/daemon"
echo "DAEMON_DIR not provided trying to find it in $DAEMON_DIR"
fi
if [ ! -d "$DAEMON_DIR" ]; then
echo 'Daemon not found.'
echo 'If you cloned the daemon in a custom location override DAEMON_DIR to point to it'
echo "You can also use our meta repo which contains both:
https://review.jami.net/admin/repos/jami-project"
exit 1
fi
export DAEMON_DIR
JNIDIR=$DAEMON_DIR/bin/jni
ANDROID_TOPLEVEL_DIR="$(pwd)"
ANDROID_APP_DIR="${ANDROID_TOPLEVEL_DIR}/jami-android"
GRADLE_PROPERTIES=
if [ -n "$ANDROID_ABI" ]; then
GRADLE_PROPERTIES="-Parchs=${ANDROID_ABI}"
fi
# Generate JNI interface
cd "$JNIDIR" || exit 1
PACKAGEDIR=$ANDROID_APP_DIR/libjamiclient/src/main/java ./make-swig.sh
if [[ $DAEMON_ONLY -eq 0 ]]; then
if [ -z "$RING_BUILD_FIREBASE" ]; then
echo "Building without Firebase support"
else
GRADLE_PROPERTIES="$GRADLE_PROPERTIES -PbuildFirebase"
echo "Building with Firebase support"
fi
if [[ $RELEASE -eq 1 ]]; then
echo "Building in release mode"
cd "$ANDROID_APP_DIR" && ./gradlew $GRADLE_PROPERTIES assembleRelease bundleRelease
elif [[ $TEST -eq 1 ]]; then
echo "Building in test mode"
cd "$ANDROID_APP_DIR" && ./gradlew $GRADLE_PROPERTIES assembleDebug assembleAndroidTest
else
echo "Building in debug mode"
echo "$GRADLE_PROPERTIES" assembleDebug
cd "$ANDROID_APP_DIR" && ./gradlew $GRADLE_PROPERTIES assembleDebug
fi
else
echo "Building daemon only"
cd "$ANDROID_APP_DIR" && ./gradlew $GRADLE_PROPERTIES buildCMakeDebug
fi