CICD: Improve Location of Scripts for the Android Build Environment.

Move around the scripts required for the setup of the build environment
for android to satisfy docker's requirement of locality.
This allows the removal of an extra copy step, and avoids the creation
of extra artefacts, while still providing the same functionality.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-01-08 07:51:43 +13:00
parent ec83e157e9
commit b5efaf661c
8 changed files with 4 additions and 21 deletions

View file

@ -0,0 +1,62 @@
#!/bin/bash -eu
# run this in the top level folder you want to create Android binaries in
#
# the script requires the Android Command Line Tools to be in cmdline-tools/bin
#
exec 1> >(tee ./build.log) 2>&1
if [ "$(uname)" != Linux ] ; then
echo "only on Linux so far"
exit 1
fi
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# these are the current versions for Qt, Android SDK & NDK:
source "$SCRIPTDIR"/variables.sh
# make sure we were started from the right directory
if [ ! -d cmdline-tools ] ; then
echo "Start from within your Android build directory which needs to already include the Android Cmdline Tools"
exit 1
fi
# make sure we have the required commands installed
MISSING=
for i in git cmake autoconf libtool java wget unzip; do
command -v $i >/dev/null ||
if [ $i = libtool ] ; then
MISSING="${MISSING}libtool-bin "
elif [ $i = java ] ; then
MISSING="${MISSING}openjdk-8-jdk "
else
MISSING="${MISSING}${i} "
fi
done
if [ "$MISSING" ] ; then
echo "The following packages are missing: $MISSING"
echo "Please install via your package manager."
exit 1
fi
# first we need to get the Android SDK and NDK
export JAVA_HOME=/usr
export ANDROID_HOME=$(pwd)
export PATH=$ANDROID_HOME/cmdline-tools/bin:/usr/local/bin:/bin:/usr/bin
rm -rf cmdline-tools/latest
yes | sdkmanager --sdk_root="$ANDROID_HOME" "ndk;$NDK_VERSION" "cmdline-tools;latest" "platform-tools" "platforms;$ANDROID_PLATFORMS" "build-tools;$ANDROID_BUILDTOOLS_REVISION"
yes | sdkmanager --sdk_root=/android --licenses
# next check that Qt is installed
if [ ! -d "$LATEST_QT" ] ; then
pip3 install aqtinstall
$HOME/.local/bin/aqt install -O /android "$LATEST_QT" linux android
fi
# now that we have an NDK, copy the font that we need for OnePlus phones
# due to https://bugreports.qt.io/browse/QTBUG-69494
cp "$ANDROID_HOME"/platforms/"$ANDROID_PLATFORMS"/data/fonts/Roboto-Regular.ttf "$SCRIPTDIR"/../../android-mobile || exit 1
echo "things are set up for the Android build"

View file

@ -12,13 +12,5 @@
# If this fails, go to https://developer.android.com/studio#cmdline-tools and
# click through for yourself, and then update the URL in the Dockerfile
# copy the dependency script into this folder
cp ../../../packaging/android/android-build-setup.sh .
cp ../../../packaging/android/variables.sh .
if [ "$1X" == "-no-docker-buildX" ]; then
exit 0
fi
# create the container (this takes a while)
docker build -t android-build .

View file

@ -0,0 +1,14 @@
#!/bin/bash
# When changing Qt version remember to update the
# qt-installer-noninteractive file as well.
QT_VERSION=5.15
LATEST_QT=5.15.1
NDK_VERSION=21.3.6528147
ANDROID_BUILDTOOLS_REVISION=29.0.3
ANDROID_PLATFORM_LEVEL=21
ANDROID_PLATFORM=android-21
ANDROID_PLATFORMS=android-29
ANDROID_NDK=ndk/${NDK_VERSION}
# OpenSSL also has an entry in get-dep-lib.sh line 103
# that needs to be updated as well.
OPENSSL_VERSION=1.1.1m