Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
fff744a9bb | |||
26e8360d65 | |||
396b88d13c | |||
3598c41f07 | |||
a69a010c7b | |||
8a961d7e5e | |||
d39a03c789 |
3 changed files with 63 additions and 19 deletions
12
Dockerfile
12
Dockerfile
|
@ -6,7 +6,7 @@ ARG QT_VERSION="5.15.5"
|
|||
ARG ANDROID_PLATFORM_VERSION="android-29"
|
||||
ARG ANDROID_BUILDTOOLS_VERSION="29.0.2"
|
||||
ARG ANDROID_NDK_VERSION="21.3.6528147"
|
||||
ARG OPENSSL_VERSION="1.1.1l_1.0.2u"
|
||||
ARG OPENSSL_VERSION="aef7ae2"
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
|
@ -27,14 +27,18 @@ RUN echo "**** setup environment ****" && \
|
|||
echo "**** download Qt and android-cli-tools ****" && \
|
||||
wget -O qt-everywhere.tar.xz ${QT_EVERYWHERE_URL} && \
|
||||
wget -O android-cli-tools.zip ${ANDROID_CLI_TOOLS_URL} && \
|
||||
wget -O android_openssl.tar.gz ${ANDROID_OPENSSL_URL} && \
|
||||
\
|
||||
echo "**** extract Qt and android-cli-tools ****" && \
|
||||
mkdir qt-everywhere && \
|
||||
tar -xf qt-everywhere.tar.xz --strip-components=1 -C ./qt-everywhere && \
|
||||
unzip android-cli-tools.zip && \
|
||||
mkdir -p /usr/lib/android-sdk/android_openssl && \
|
||||
tar -xf android_openssl.tar.gz --strip-components=1 -C /usr/lib/android-sdk/android_openssl && \
|
||||
mkdir -p /usr/lib/android-sdk && \
|
||||
\
|
||||
echo "**** download prebuilt openssl libs ****" && \
|
||||
git clone https://github.com/KDAB/android_openssl.git /usr/lib/android-sdk/android_openssl && \
|
||||
cd /usr/lib/android-sdk/android_openssl && \
|
||||
git checkout "${OPENSSL_VERSION}" && \
|
||||
cd /workspace && \
|
||||
\
|
||||
echo "**** install android sdk ****" && \
|
||||
echo "y" | ./cmdline-tools/bin/sdkmanager --sdk_root=/usr/lib/android-sdk --install "platform-tools" "platforms;${ANDROID_PLATFORM_VERSION}" "build-tools;${ANDROID_BUILDTOOLS_VERSION}" "ndk;${ANDROID_NDK_VERSION}" && \
|
||||
|
|
27
README.md
27
README.md
|
@ -8,6 +8,11 @@ The following settings changes this plugin's behavior.
|
|||
|
||||
* qmake_arguments (optional) additional arguments for qmake.
|
||||
* androiddeployqt_arguments (optional) additional arguments for androiddeployqt.
|
||||
* src_dir (optional) the path to the source directory
|
||||
* android_keystore_path (optional) the path to the android_keystore file.
|
||||
* android_keystore_data (optional, secret recommended) the keystore file encoded as base64. If set, android_keystore_path will be ignored!
|
||||
* android_keystore_alias (required, if android_keystore_path or android_keystore_data is set) the keystore alias.
|
||||
* android_keystore_store_pass (optional, secret recommended) the password for the keystore.
|
||||
|
||||
Below is an example `.drone.yml` that uses this plugin.
|
||||
|
||||
|
@ -20,15 +25,21 @@ steps:
|
|||
image: itsblue.dev/plugins/qt-android
|
||||
pull: if-not-exists
|
||||
settings:
|
||||
qmake_attributes: "CONFIG+=release"
|
||||
androiddeployqt_attributes: "--aab"
|
||||
qmake_arguments: "CONFIG+=release"
|
||||
androiddeployqt_arguments: "--aab"
|
||||
src_dir: "."
|
||||
android_keystore_data:
|
||||
from_secret: android_keystore_data
|
||||
android_keystore_alias: "foo"
|
||||
android_keystore_store_pass:
|
||||
from_secret: android_keystore_store_pass
|
||||
```
|
||||
|
||||
# Building
|
||||
|
||||
Build the plugin image:
|
||||
|
||||
```text
|
||||
```bash
|
||||
docker build -t itsblue.dev/plugins/qt-android -f Dockerfile .
|
||||
```
|
||||
|
||||
|
@ -36,14 +47,18 @@ docker build -t itsblue.dev/plugins/qt-android -f Dockerfile .
|
|||
|
||||
Execute the plugin from your current working directory:
|
||||
|
||||
```text
|
||||
```bash
|
||||
docker run --rm \
|
||||
-e DRONE_COMMIT_SHA=8f51ad7884c5eb69c11d260a31da7a745e6b78e2 \
|
||||
-e DRONE_COMMIT_BRANCH=master \
|
||||
-e DRONE_BUILD_NUMBER=43 \
|
||||
-e DRONE_BUILD_STATUS=success \
|
||||
-e PLUGIN_QMAKE_ARGUMENTS="CONFIG+=release"
|
||||
-e PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS="--aab"
|
||||
-e PLUGIN_QMAKE_ARGUMENTS="CONFIG+=release" \
|
||||
-e PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS="--aab" \
|
||||
-e PLUGIN_SRC_DIR="." \
|
||||
-e PLUGIN_ANDROID_KEYSTORE_PATH="android_release.keystore" \
|
||||
-e PLUGIN_ANDROID_KEYSTORE_ALIAS="foo" \
|
||||
-e PLUGIN_ANDROID_KEYSTORE_STORE_PASS="strong_password" \
|
||||
-w /drone/src \
|
||||
-v $(pwd):/drone/src \
|
||||
itsblue.dev/plugins/qt-android
|
||||
|
|
43
qt-build
43
qt-build
|
@ -1,21 +1,46 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
[[ -z "${PLUGIN_QMAKE_ARGUMENTS}" ]] && QMAKE_ARGUMENTS=$1 || QMAKE_ARGUMENTS="${PLUGIN_QMAKE_ARGUMENTS}"
|
||||
[[ -z "${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}" ]] && ANDROIDDEPLOYQT_ARGUMENTS=$2 || ANDROIDDEPLOYQT_ARGUMENTS="${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}"
|
||||
[[ -z "${PLUGIN_QMAKE_ARGUMENTS}" ]] && QMAKE_ARGUMENTS="" || QMAKE_ARGUMENTS="${PLUGIN_QMAKE_ARGUMENTS}"
|
||||
[[ -z "${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}" ]] && ANDROIDDEPLOYQT_ARGUMENTS="" || ANDROIDDEPLOYQT_ARGUMENTS="${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}"
|
||||
[[ -z "${PLUGIN_SRC_DIR}" ]] && SRC_DIR=$(pwd) || SRC_DIR=$(realpath "${PLUGIN_SRC_DIR}")
|
||||
[[ -z "${PLUGIN_ANDROID_KEYSTORE_PATH}" ]] && ANDROID_KEYSTORE_PATH="" || ANDROID_KEYSTORE_PATH=$(realpath "${PLUGIN_ANDROID_KEYSTORE_PATH}")
|
||||
[[ -z "${PLUGIN_ANDROID_KEYSTORE_DATA}" ]] && ANDROID_KEYSTORE_DATA="" || ANDROID_KEYSTORE_DATA="${PLUGIN_ANDROID_KEYSTORE_DATA}"
|
||||
[[ -z "${PLUGIN_ANDROID_KEYSTORE_ALIAS}" ]] && ANDROID_KEYSTORE_ALIAS="" || ANDROID_KEYSTORE_ALIAS="${PLUGIN_ANDROID_KEYSTORE_ALIAS}"
|
||||
[[ -z "${PLUGIN_ANDROID_KEYSTORE_STORE_PASS}" ]] && ANDROID_KEYSTORE_STORE_PASS="" || ANDROID_KEYSTORE_STORE_PASS="${PLUGIN_ANDROID_KEYSTORE_STORE_PASS}"
|
||||
|
||||
echo "**** environment: ****"
|
||||
echo "* QMAKE_ARGUMENTS=${QMAKE_ARGUMENTS}"
|
||||
echo "* ANDROIDDEPLOYQT_ARGUMENTS=${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}"
|
||||
echo "* SRC_DIR=${SRC_DIR}"
|
||||
echo "**********************"
|
||||
echo ""
|
||||
echo "**** prepare ****"
|
||||
rm -rf /build
|
||||
mkdir -p /build
|
||||
cd /build
|
||||
|
||||
echo ""
|
||||
echo "**** environment: ****"
|
||||
echo "* QMAKE_ARGUMENTS=${QMAKE_ARGUMENTS}"
|
||||
echo "* ANDROIDDEPLOYQT_ARGUMENTS=${ANDROIDDEPLOYQT_ARGUMENTS}"
|
||||
echo "* SRC_DIR=${SRC_DIR}"
|
||||
|
||||
# handle signing stuff
|
||||
if ( [ -n "$ANDROID_KEYSTORE_DATA" ] || [ -n "$ANDROID_KEYSTORE_PATH" ] ) && [ -n "$ANDROID_KEYSTORE_ALIAS" ]; then
|
||||
if [ -n "$ANDROID_KEYSTORE_DATA" ]; then
|
||||
echo $ANDROID_KEYSTORE_DATA | tr ' ' '\n' | base64 -d > /build/android_release.keystore
|
||||
ANDROID_KEYSTORE_PATH=/build/android_release.keystore
|
||||
echo "* SIGNING with keystore from provided data"
|
||||
else
|
||||
echo "* SIGNING with keystore $ANDROID_KEYSTORE_PATH"
|
||||
fi
|
||||
|
||||
ANDROIDDEPLOYQT_ARGUMENTS="$ANDROIDDEPLOYQT_ARGUMENTS --sign $ANDROID_KEYSTORE_PATH $ANDROID_KEYSTORE_ALIAS"
|
||||
if [ -n "$ANDROID_KEYSTORE_STORE_PASS" ]; then
|
||||
ANDROIDDEPLOYQT_ARGUMENTS="$ANDROIDDEPLOYQT_ARGUMENTS --storepass $ANDROID_KEYSTORE_STORE_PASS"
|
||||
fi
|
||||
else
|
||||
echo "* NO signing"
|
||||
fi
|
||||
|
||||
echo "**********************"
|
||||
echo ""
|
||||
|
||||
echo "**** qmake ****"
|
||||
qmake $QMAKE_ARGUMENTS $SRC_DIR
|
||||
|
||||
|
@ -24,7 +49,7 @@ make -j8
|
|||
make INSTALL_ROOT=/build/android-build install
|
||||
|
||||
echo "**** android build ****"
|
||||
androiddeployqt --input $(ls -1 /build/android-*-deployment-settings.json) --output /build/android-build --gradle $ANDROIDDEPLOYQT_ARGUMENTS
|
||||
androiddeployqt --input $(ls -1 /build/android-*-deployment-settings.json) --output /build/android-build $ANDROIDDEPLOYQT_ARGUMENTS
|
||||
|
||||
echo "**** finish up ****"
|
||||
mv /build/android-build//build/outputs $SRC_DIR/outputs
|
||||
|
|
Loading…
Reference in a new issue