forked from HelloVolla/android-launcher-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_package_android
executable file
·62 lines (50 loc) · 2.13 KB
/
build_package_android
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
#!/bin/bash
BUILD_TARGET=${BUILD_TARGET:-android_arm64_v8a}
TIMESTAMP=`date +%Y%m%d`
BUILD_ID=${BUILD_ID:-$TIMESTAMP}
WORKSPACE=${WORKSPACE:-$PWD}
BUILD_DIR=$WORKSPACE/build/$BUILD_TARGET
ANDROID_BUILD_DIR=${BUILD_DIR}/com.volla.launcher-${BUILD_TARGET}-${BUILD_ID}/
RELEASE_DIR=${1:-"$WORKSPACE/releases"}
RELEASE_DIR="`readlink -fm $RELEASE_DIR`"
#Got the platform from readme of https://github.com/a12e/docker-qt
SDK_PLATFORM=android-28
die() {
echo $@
echo "Make sure your sources are compilable and run this script only in the build container."
exit -1
}
cd $WORKSPACE
git submodule init
git submodule update
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
mkdir -p $ANDROID_BUILD_DIR
mkdir -p $RELEASE_DIR
cd $BUILD_DIR
# Run qmake, optional: ship the OpenSSL libraries
qmake -r $WORKSPACE ANDROID_EXTRA_LIBS+=$ANDROID_DEV/lib/libcrypto.so ANDROID_EXTRA_LIBS+=$ANDROID_DEV/lib/libssl.so
make -j`nproc` || die "Building the sources failed"
make install INSTALL_ROOT=$ANDROID_BUILD_DIR
# Create APK
if [[ -z "${ANDROID_KEYSTORE_FILE_CONTENTS}" ]] || [[ -z "${ANDROID_KEYSTORE_PASS}" ]] || [[ -z "${ANDROID_KEYSTORE_ALIAS}" ]]; then
echo "Creating a Debug APK"
androiddeployqt --input android-libvolla-launcher.so-deployment-settings.json \
--output $ANDROID_BUILD_DIR \
--android-platform $SDK_PLATFORM \
--deployment bundled \
--gradle || die "Building APK failed"
else
echo "Creating a Signed Release apk"
ANDROID_KEYSTORE_FILE=/tmp/keystore
echo $ANDROID_KEYSTORE_FILE_CONTENTS | base64 -di > $ANDROID_KEYSTORE_FILE
androiddeployqt --input android-libvolla-launcher.so-deployment-settings.json \
--output $ANDROID_BUILD_DIR \
--android-platform $SDK_PLATFORM \
--deployment bundled \
--gradle \
--sign $ANDROID_KEYSTORE_FILE $ANDROID_KEYSTORE_ALIAS \
--storepass $ANDROID_KEYSTORE_PASS || die "Building APK failed"
shred -uz $ANDROID_KEYSTORE_FILE
fi
mv $ANDROID_BUILD_DIR/build/outputs/apk/**/*.apk $RELEASE_DIR/ || die "No APK was found to deploy to the release dir"