-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild_package
executable file
·46 lines (39 loc) · 1.51 KB
/
build_package
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
#!/bin/bash
BUILD_TARGET=${1:-android_arm64_v8a}
WORKSPACE=${WORKSPACE:-$PWD}
WORKSPACE=`realpath $WORKSPACE`
EXECUTABLE=${EXECUTABLE:-$WORKSPACE/build_package_android}
if [[ "$BUILD_TARGET" != "android_arm64_v8a" && "$BUILD_TARGET" != "android_armv7" ]]; then
echo "Usage: build_package [BUILD_TARGET]"
echo " BUILD_TARGET *MUST* be one of: android_arm64_v8a, android_armv7"
exit -1
fi
# The container we use is: a12e/docker-qt:5.13-android_arm64_v8a
CONTAINER=${CONTAINER:-a12e/docker-qt:5.13-$BUILD_TARGET}
TIMESTAMP=`date +%Y%m%d`
BUILD_ID=${BUILD_ID:-$TIMESTAMP}
CACHE_DIR=$WORKSPACE/.cache
CCACHE_DIR=$CACHE_DIR/.ccache
GRADLE_DIR=$CACHE_DIR/.gradle
MAVEN_DIR=$CACHE_DIR/.m2
mkdir -p $WORKSPACE
mkdir -p $CCACHE_DIR
mkdir -p $GRADLE_DIR
[[ -v DISPLAY ]] && xhost +local:root
docker run --rm \
-e BUILD_ID="$BUILD_ID" \
-e WORKSPACE="$WORKSPACE" \
-e CCACHE_DIR="$CCACHE_DIR" \
-e GRADLE_USER_HOME="$GRADLE_DIR" \
-e M2_HOME="$MAVEN_DIR" \
-e MAVEN_HOME="$MAVEN_DIR" \
-e BUILD_TARGET="$BUILD_TARGET" \
-e ANDROID_KEYSTORE_FILE_CONTENTS="$ANDROID_KEYSTORE_FILE_CONTENTS" \
-e ANDROID_KEYSTORE_ALIAS="$ANDROID_KEYSTORE_ALIAS" \
-e ANDROID_KEYSTORE_PASS="$ANDROID_KEYSTORE_PASS" \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $CCACHE_DIR:$CCACHE_DIR \
-v $GRADLE_DIR:$GRADLE_DIR \
-v $WORKSPACE:$WORKSPACE -it \
-u $USER \
$CONTAINER $EXECUTABLE