Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·73 lines (60 loc) · 1.95 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·73 lines (60 loc) · 1.95 KB
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
### Bash script for building the Backtalk APKs, for phones and watches
###
### The following environment variables must be set before executing this script
### ANDROID_SDK # path to local copy of Android SDK
# For help in getting the correct version numbers of gradle, the gradle plugin,
# and Java, see the following:
# https://developer.android.com/build/releases/gradle-plugin#updating-gradle
# https://docs.gradle.org/current/userguide/compatibility.html
START_TIME=$SECONDS
echo "pwd: $(pwd)"
echo "ls"; ls
# Use these environment variables to get more info during the build
# GRADLE_DEBUG=--debug
# GRADLE_STACKTRACE=--stacktrace
echo "#### GRADLE_DEBUG: $GRADLE_DEBUG"
echo "#### GRADLE_STACKTRACE: $GRADLE_STACKTRACE"
if [[ -z "$ANDROID_SDK" ]]; then
echo "#### The environment variable ANDROID_SDK is not set"
exit 1
else
echo "#### ANDROID_SDK: $ANDROID_SDK"
fi
echo
# Keep anything else in local.properties, such as gemini.api.key, and only add the SDK path.
if ! grep -q '^sdk\.dir=' local.properties 2>/dev/null; then
echo "#### Add sdk.dir to local.properties"
echo "sdk.dir=${ANDROID_SDK}" >> local.properties
fi
echo
if ! java -version; then
echo "#### java command not found in PATH"
exit 1
fi
if ! ./gradlew -version; then
echo "#### gradlew failed to start"
exit 1
fi
if [[ "$GRADLE_DEBUG" = "--debug" ]]; then
echo "#### gradle buildEnvironment"
./gradlew buildEnvironment
echo
echo "#### gradle dependencies"
./gradlew dependencies
echo
echo "#### gradle properties"
./gradlew properties
echo
fi
echo "#### gradlew $GRADLE_DEBUG $GRADLE_STACKTRACE assembleDebug"
./gradlew ${GRADLE_DEBUG} ${GRADLE_STACKTRACE} assembleDebug
BUILD_EXIT_CODE=$?
echo
if [[ $BUILD_EXIT_CODE -eq 0 ]]; then
echo "#### find . -name *.apk"
find . -name "*.apk"
echo
fi
DURATION=$(( SECONDS - START_TIME ))
echo "#### Build took this many seconds: $DURATION"
exit $BUILD_EXIT_CODE ### This should be the last line in this file