forked from eduvpn/android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_app_tar.sh
executable file
·57 lines (44 loc) · 1.88 KB
/
build_app_tar.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
#!/bin/sh
###############################################################################
# CONFIGURATION
###############################################################################
SDK_DIR=${HOME}/android-sdk
KEY_STORE=${HOME}/android.jks
V=2.0.4
DOWNLOAD_URL=https://github.com/eduvpn/android/releases/download/${V}/eduvpn-android-${V}.tar.xz
PROJECT_DIR=${HOME}/Projects
APP_DIR=${PROJECT_DIR}/eduvpn-android-${V}
# eduVPN
GRADLE_TASK=app:assembleBasicRelease
UNSIGNED_APK=${APP_DIR}/app/build/outputs/apk/basic/release/app-basic-release-unsigned.apk
SIGNED_APK=${PROJECT_DIR}/eduVPN-${V}.apk
# Let's Connect!
#GRADLE_TASK=app:assembleHomeRelease
#UNSIGNED_APK=${APP_DIR}/app/build/outputs/apk/home/release/app-home-release-unsigned.apk
#SIGNED_APK=${PROJECT_DIR}/LetsConnect-${V}.apk
###############################################################################
# CLONE
###############################################################################
(
mkdir -p "${PROJECT_DIR}"
cd "${PROJECT_DIR}" || exit
curl -L -o eduvpn-android-${V}.tar.xz "${DOWNLOAD_URL}"
tar -xJf eduvpn-android-${V}.tar.xz
)
###############################################################################
# BUILD
###############################################################################
(
export ANDROID_HOME=${SDK_DIR}
cd "${APP_DIR}" || exit
./gradlew ${GRADLE_TASK} --warning-mode all --stacktrace || exit
)
###############################################################################
# SIGN
###############################################################################
(
# pick the newest build tools in case multiple versions are available
BUILD_TOOLS_VERSION=$(ls ${SDK_DIR}/build-tools/ | sort -r | head -1)
${SDK_DIR}/build-tools/${BUILD_TOOLS_VERSION}/apksigner sign --ks "${KEY_STORE}" "${UNSIGNED_APK}" || exit
cp "${UNSIGNED_APK}" "${SIGNED_APK}" || exit
)