summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml18
-rw-r--r--docker-compose.yml42
-rw-r--r--docker/focal/test-android-no-qt.Dockerfile105
-rw-r--r--docker/focal/test-android.Dockerfile7
-rwxr-xr-xscripts/test-for-android.sh66
-rwxr-xr-xscripts/test-qt-for-android.sh4
-rw-r--r--share/qbs/modules/cpp/android-gcc.qbs5
-rw-r--r--tests/auto/blackbox/tst_blackboxandroid.cpp2
8 files changed, 239 insertions, 10 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 70a283159..935605566 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -353,6 +353,24 @@ jobs:
script: './scripts/test-qt-for-android.sh',
}
- {
+ name: 'Run Android tests (ndk r19c)',
+ image: 'focal-android-ndk-r19c',
+ profile: '',
+ script: './scripts/test-for-android.sh',
+ }
+ - {
+ name: 'Run Android tests (ndk r21e)',
+ image: 'focal-android-ndk-r21e',
+ profile: '',
+ script: './scripts/test-for-android.sh',
+ }
+ - {
+ name: 'Run Android tests (ndk r23)',
+ image: 'focal-android-ndk-r23',
+ profile: '',
+ script: './scripts/test-for-android.sh',
+ }
+ - {
name: 'Run Linux tests (Qt 4.8.7)',
image: 'focal-qt4',
profile: '',
diff --git a/docker-compose.yml b/docker-compose.yml
index 284e6086f..77a79f2b1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -43,42 +43,76 @@ services:
focal-android-513:
<< : *linux
hostname: focal-android
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.13.2-2
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.13.2-3
build:
dockerfile: docker/focal/test-android.Dockerfile
context: .
args:
QT_VERSION: 5.13.2
+ ANDROID_NDK_VERSION: 23.0.7599858
focal-android-514:
<< : *linux
hostname: focal-android
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.14.0-2
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.14.0-3
build:
dockerfile: docker/focal/test-android.Dockerfile
context: .
args:
QT_VERSION: 5.14.0
+ ANDROID_NDK_VERSION: 23.0.7599858
focal-android-515:
<< : *linux
hostname: focal-android
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.15.1-2
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.15.1-3
build:
dockerfile: docker/focal/test-android.Dockerfile
context: .
args:
QT_VERSION: 5.15.1
+ ANDROID_NDK_VERSION: 23.0.7599858
focal-android-600:
<< : *linux
hostname: focal-android
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-6.0.0-2
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-6.0.0-3
build:
dockerfile: docker/focal/test-android.Dockerfile
context: .
args:
QT_VERSION: 6.0.0
+ ANDROID_NDK_VERSION: 23.0.7599858
+
+ focal-android-ndk-r19c:
+ << : *linux
+ hostname: focal-android
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-ndk-r19c-0
+ build:
+ dockerfile: docker/focal/test-android-no-qt.Dockerfile
+ context: .
+ args:
+ ANDROID_NDK_VERSION: 19.2.5345600
+
+ focal-android-ndk-r21e:
+ << : *linux
+ hostname: focal-android
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-ndk-r21e-0
+ build:
+ dockerfile: docker/focal/test-android-no-qt.Dockerfile
+ context: .
+ args:
+ ANDROID_NDK_VERSION: 21.4.7075529
+
+ focal-android-ndk-r23:
+ << : *linux
+ hostname: focal-android
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-ndk-r23-0
+ build:
+ dockerfile: docker/focal/test-android-no-qt.Dockerfile
+ context: .
+ args:
+ ANDROID_NDK_VERSION: 23.0.7599858
focal-baremetal:
<< : *linux
diff --git a/docker/focal/test-android-no-qt.Dockerfile b/docker/focal/test-android-no-qt.Dockerfile
new file mode 100644
index 000000000..e1622043a
--- /dev/null
+++ b/docker/focal/test-android-no-qt.Dockerfile
@@ -0,0 +1,105 @@
+#
+# Android SDK/NDK for testing Qbs
+#
+FROM ubuntu:focal
+LABEL Description="Ubuntu test environment for Qbs for Android"
+
+# Allow colored output on command line.
+ENV TERM=xterm-color
+
+#
+# Make it possible to change UID/GID in the entrypoint script. The docker
+# container usually runs as root user on Linux hosts. When the Docker container
+# mounts a folder on the host and creates files there, those files would be
+# owned by root instead of the current user. Thus we create a user here who's
+# UID will be changed in the entrypoint script to match the UID of the current
+# host user.
+#
+ARG USER_UID=1000
+ARG USER_NAME=devel
+RUN apt-get update -qq && \
+ apt-get install -qq -y \
+ ca-certificates \
+ gosu \
+ sudo && \
+ groupadd -g ${USER_UID} ${USER_NAME} && \
+ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \
+ usermod -a -G sudo ${USER_NAME} && \
+ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
+
+COPY docker/focal/entrypoint.sh /sbin/entrypoint.sh
+ENTRYPOINT ["/sbin/entrypoint.sh"]
+
+# Qbs build dependencies
+RUN apt-get update -qq && \
+ apt-get install -qq -y --no-install-recommends \
+ ca-certificates \
+ curl \
+ libasan5 \
+ libglib2.0-0 \
+ openjdk-8-jdk-headless \
+ p7zip-full \
+ unzip
+
+ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+RUN echo "export JAVA_HOME=${JAVA_HOME}" > /etc/profile.d/android.sh && \
+ echo "export PATH=${JAVA_HOME}/bin:\${PATH}" >> /etc/profile.d/android.sh
+
+ARG ANDROID_NDK_VERSION
+
+ENV ANDROID_HOME="/home/${USER_NAME}/android"
+ENV ANDROID_SDK_ROOT=${ANDROID_HOME}
+ENV ANDROID_NDK_ROOT=${ANDROID_HOME}/"ndk"/${ANDROID_NDK_VERSION}
+ENV PATH="${JAVA_HOME}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:$PATH"
+RUN echo "export ANDROID_HOME=/home/${USER_NAME}/android" >> /etc/profile.d/android.sh && \
+ echo "export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" >> /etc/profile.d/android.sh && \
+ echo "export ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}" >> /etc/profile.d/android.sh && \
+ echo "export PATH=${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:\$PATH" >> /etc/profile.d/android.sh
+
+#
+# We ned to run the following steps as the target user
+#
+USER ${USER_NAME}
+RUN mkdir ${ANDROID_HOME}
+
+# Get Android command line tools
+ARG COMMAND_LINE_TOOLS_VERSION="6858069"
+RUN curl -s https://dl.google.com/android/repository/commandlinetools-linux-${COMMAND_LINE_TOOLS_VERSION}_latest.zip > ${ANDROID_HOME}/commandlinetools.zip && \
+ unzip ${ANDROID_HOME}/commandlinetools.zip -d ${ANDROID_HOME} && \
+ rm -v ${ANDROID_HOME}/commandlinetools.zip
+
+# Accept SDK license
+ARG ANDROID_PLATFORM="android-29"
+ARG BUILD_TOOLS="29.0.2"
+RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" --verbose --licenses && \
+ sdkmanager "--sdk_root=${ANDROID_HOME}" --update && \
+ sdkmanager "--sdk_root=${ANDROID_HOME}" "platforms;${ANDROID_PLATFORM}"
+
+RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "build-tools;${BUILD_TOOLS}"
+RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "platform-tools"
+RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "tools"
+RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "ndk;${ANDROID_NDK_VERSION}"
+
+RUN /usr/lib/jvm/java-8-openjdk-amd64/bin/keytool -genkey -keystore /home/${USER_NAME}/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname 'CN=Android Debug,O=Android,C=US'
+
+# Install ndk samples in ${ANDROID_NDK_ROOT}/samples
+RUN cd ${ANDROID_NDK_ROOT} && \
+ curl -sLO https://github.com/android/ndk-samples/archive/master.zip && \
+ unzip -q master.zip && \
+ rm -v master.zip && \
+ mv ndk-samples-master samples
+
+# Install android-BasicMediaDecoder in ${ANDROID_SDK_ROOT}/samples
+RUN mkdir ${ANDROID_SDK_ROOT}/samples && \
+ cd ${ANDROID_SDK_ROOT}/samples && \
+ curl -sLO https://github.com/googlearchive/android-BasicMediaDecoder/archive/master.zip && \
+ unzip -q master.zip && \
+ rm -v master.zip && \
+ mv android-BasicMediaDecoder-master android-BasicMediaDecoder
+
+# Download buildtool to generate aab packages in ${ANDROID_SDK_ROOT}
+RUN cd ${ANDROID_SDK_ROOT} && \
+ curl -sLO https://github.com/google/bundletool/releases/download/1.3.0/bundletool-all-1.3.0.jar
+
+USER root
+
diff --git a/docker/focal/test-android.Dockerfile b/docker/focal/test-android.Dockerfile
index 11c4a5757..ca7223593 100644
--- a/docker/focal/test-android.Dockerfile
+++ b/docker/focal/test-android.Dockerfile
@@ -37,7 +37,6 @@ RUN apt-get update -qq && \
curl \
libasan5 \
libglib2.0-0 \
- libgl1-mesa-glx \
openjdk-8-jdk-headless \
p7zip-full \
unzip
@@ -46,9 +45,11 @@ ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
RUN echo "export JAVA_HOME=${JAVA_HOME}" > /etc/profile.d/android.sh && \
echo "export PATH=${JAVA_HOME}/bin:\${PATH}" >> /etc/profile.d/android.sh
+ARG ANDROID_NDK_VERSION
+
ENV ANDROID_HOME="/home/${USER_NAME}/android"
ENV ANDROID_SDK_ROOT=${ANDROID_HOME}
-ENV ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk-bundle
+ENV ANDROID_NDK_ROOT=${ANDROID_HOME}/"ndk"/${ANDROID_NDK_VERSION}
ENV PATH="${JAVA_HOME}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/cmdline-tools/bin:$PATH"
RUN echo "export ANDROID_HOME=/home/${USER_NAME}/android" >> /etc/profile.d/android.sh && \
echo "export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" >> /etc/profile.d/android.sh && \
@@ -77,7 +78,7 @@ RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" --verbose --licenses && \
RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "build-tools;${BUILD_TOOLS}"
RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "platform-tools"
RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "tools"
-RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "ndk-bundle"
+RUN yes | sdkmanager "--sdk_root=${ANDROID_HOME}" "ndk;${ANDROID_NDK_VERSION}"
RUN /usr/lib/jvm/java-8-openjdk-amd64/bin/keytool -genkey -keystore /home/${USER_NAME}/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname 'CN=Android Debug,O=Android,C=US'
diff --git a/scripts/test-for-android.sh b/scripts/test-for-android.sh
new file mode 100755
index 000000000..34a7c0526
--- /dev/null
+++ b/scripts/test-for-android.sh
@@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+set -eu
+
+#############################################################################
+##
+## Copyright (C) 2019 Richard Weickelt.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qbs.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+export PATH="$1:$PATH"
+
+export LSAN_OPTIONS="suppressions=$( cd "$(dirname "$0")" ; pwd -P )/address-sanitizer-suppressions.txt:print_suppressions=0"
+
+#
+# These are set outside of this script, for instance in the Docker image
+#
+echo "Android SDK installed at ${ANDROID_SDK_ROOT}"
+echo "Android NDK installed at ${ANDROID_NDK_ROOT}"
+
+# Cleaning profiles
+qbs config --unset profiles.qbs_autotests-android
+
+# Setting auto test profiles
+qbs setup-android --ndk-dir ${ANDROID_NDK_ROOT} --sdk-dir ${ANDROID_HOME} qbs_autotests-android
+
+export QBS_AUTOTEST_PROFILE=qbs_autotests-android
+export QBS_AUTOTEST_ALWAYS_LOG_STDERR=true
+export QTEST_FUNCTION_TIMEOUT=9000000
+
+qbs config --list
+
+tst_blackbox-android
+
diff --git a/scripts/test-qt-for-android.sh b/scripts/test-qt-for-android.sh
index 55ef991d4..ae1338fb2 100755
--- a/scripts/test-qt-for-android.sh
+++ b/scripts/test-qt-for-android.sh
@@ -57,8 +57,8 @@ qbs config --unset profiles.qbs_autotests-android
qbs config --unset profiles.qbs_autotests-android-qt
# Setting auto test profiles
-qbs setup-android --ndk-dir ${ANDROID_HOME}/ndk-bundle --sdk-dir ${ANDROID_HOME} qbs_autotests-android
-qbs setup-android --ndk-dir ${ANDROID_HOME}/ndk-bundle --sdk-dir ${ANDROID_HOME} --qt-dir ${QT_INSTALL_DIR} qbs_autotests-android-qt
+qbs setup-android --ndk-dir ${ANDROID_NDK_ROOT} --sdk-dir ${ANDROID_SDK_ROOT} qbs_autotests-android
+qbs setup-android --ndk-dir ${ANDROID_NDK_ROOT} --sdk-dir ${ANDROID_SDK_ROOT} --qt-dir ${QT_INSTALL_DIR} qbs_autotests-android-qt
export QBS_AUTOTEST_PROFILE=qbs_autotests-android
export QBS_AUTOTEST_ALWAYS_LOG_STDERR=true
diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs
index a5061e166..6e19a0e7d 100644
--- a/share/qbs/modules/cpp/android-gcc.qbs
+++ b/share/qbs/modules/cpp/android-gcc.qbs
@@ -125,6 +125,11 @@ LinuxGCC {
}
staticLibraries: staticStlFilePath
+ // When using ndk r19c, llvm doesn't add sysroot/usr/include/c++/v1 to the path
+ // But it works starting with ndk r20b
+ systemIncludePaths: (Utilities.versionCompare(Android.ndk.version, "20") < 0) ?
+ FileInfo.joinPaths(sysroot, "usr", "include", "c++", "v1") : ""
+
defines: ["ANDROID", "__ANDROID__"]
binutilsPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt",
diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp
index ba864ed78..0d66f60bb 100644
--- a/tests/auto/blackbox/tst_blackboxandroid.cpp
+++ b/tests/auto/blackbox/tst_blackboxandroid.cpp
@@ -93,7 +93,7 @@ void TestBlackboxAndroid::android()
const SettingsPtr s = settings();
Profile p(theProfileName(projectDir == "qml-app" || projectDir == "qt-app"), s.get());
if (!p.exists())
- p = Profile("none", s.get());
+ QSKIP("Qt is not installed");
int status;
const auto androidPaths = findAndroid(&status, p.name());
QCOMPARE(status, 0);