Compare commits

..

No commits in common. "main" and "v5.15.5-1" have entirely different histories.

4 changed files with 19 additions and 89 deletions

View file

@ -12,15 +12,4 @@ steps:
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: release
image: plugins/gitea-release
settings:
base_url: https://itsblue.dev
api_key:
from_secret: docker_password
trigger:
ref:
- refs/tags/v*
from_secret: docker_password

View file

@ -6,7 +6,6 @@ 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="aef7ae2"
WORKDIR /workspace
@ -16,7 +15,6 @@ RUN echo "**** setup environment ****" && \
export PATH=$QT_INSTALL_DIR/bin:$JAVA_HOME/bin:$PATH && \
export QT_EVERYWHERE_URL="https://download.qt.io/archive/qt/${QT_VERSION_FAMILY}/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz" && \
export ANDROID_CLI_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip" && \
export ANDROID_OPENSSL_URL="https://github.com/KDAB/android_openssl/archive/refs/tags/${OPENSSL_VERSION}.tar.gz" && \
\
echo "**** install dependencies ****" && \
dpkg --add-architecture i386 && \
@ -32,13 +30,6 @@ RUN echo "**** setup environment ****" && \
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 && \
\
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}" && \
@ -67,7 +58,6 @@ RUN echo "**** setup environment ****" && \
echo "**** done ****"
ENV PATH="${PATH}:/usr/lib/qt/bin:/usr/lib/jvm/java-8-openjdk-amd64/bin"
ENV ANDROID_HOME=/usr/lib/android-sdk
WORKDIR /src
COPY "qt-build" "/usr/local/bin/qt-build"

View file

@ -8,11 +8,6 @@ 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.
@ -25,21 +20,15 @@ steps:
image: itsblue.dev/plugins/qt-android
pull: if-not-exists
settings:
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
qmake_attributes: "CONFIG+=release"
androiddeployqt_attributes: "--aab"
```
# Building
Build the plugin image:
```bash
```text
docker build -t itsblue.dev/plugins/qt-android -f Dockerfile .
```
@ -47,29 +36,15 @@ docker build -t itsblue.dev/plugins/qt-android -f Dockerfile .
Execute the plugin from your current working directory:
```bash
docker run --rm \
```text
docker run --rm -e PLUGIN_FOLDER=public -e PLUGIN_SSH_KEY=foo \
-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_SRC_DIR="." \
-e PLUGIN_ANDROID_KEYSTORE_PATH="android_release.keystore" \
-e PLUGIN_ANDROID_KEYSTORE_ALIAS="foo" \
-e PLUGIN_ANDROID_KEYSTORE_STORE_PASS="strong_password" \
-e PLUGIN_QMAKE_ARGUMENTS="CONFIG+=release"
-e PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS="--aab"
-w /drone/src \
-v $(pwd):/drone/src \
itsblue.dev/plugins/qt-android
```
# Using openssl
This image includes [prebuilt openssl libraries](https://github.com/KDAB/android_openssl). You may include them in your .pro file like so:
```pro
android {
ANDROID_HOME = $$(ANDROID_HOME)
include($$ANDROID_HOME/android_openssl/openssl.pri)
}
```

View file

@ -1,46 +1,22 @@
#!/bin/bash
set -e
[[ -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}"
[[ -z "${PLUGIN_QMAKE_ARGUMENTS}" ]] && QMAKE_ARGUMENTS=$1 || QMAKE_ARGUMENTS="${PLUGIN_QMAKE_ARGUMENTS}"
[[ -z "${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}" ]] && ANDROIDDEPLOYQT_ARGUMENTS=$2 || ANDROIDDEPLOYQT_ARGUMENTS="${PLUGIN_ANDROIDDEPLOYQT_ARGUMENTS}"
SRC_DIR=$(pwd)
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
@ -49,7 +25,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 $ANDROIDDEPLOYQT_ARGUMENTS
androiddeployqt --input $(ls -1 /build/android-*-deployment-settings.json) --output /build/android-build --gradle $ANDROIDDEPLOYQT_ARGUMENTS
echo "**** finish up ****"
mv /build/android-build//build/outputs $SRC_DIR/outputs