diff options
9 files changed, 206 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index 2ee869657..3f599cd00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,15 @@ jobs: script: - docker-compose run --rm bionic scripts/run-analyzer.sh + - <<: *build-on-bionic + name: With Qbs and with Qt for Android (Qt 5.13) + before_install: + - docker-compose pull bionic + - docker-compose pull bionic-android-513 + script: + - docker-compose run bionic qbs build modules.cpp.compilerWrapper:ccache modules.qbsbuildconfig.enableBundledQt:true config:release + - docker-compose run bionic-android-513 scripts/test-qt-for-android.sh release/install-root/usr/local/bin + - &build-on-macos stage: Build Qbs and and run autotests name: With Qbs on macOS (xcode 10.3) diff --git a/docker-compose.yml b/docker-compose.yml index e5c7329c2..6f7b9954b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,6 +23,26 @@ services: QT_VERSION: 5.12.6 QTCREATOR_VERSION: 4.10.2 + bionic-android-513: + << : *linux + hostname: bionic-android + image: ${DOCKER_USER:-qbsbuild}/qbsdev:bionic-android-5.13.2-0 + build: + dockerfile: docker/bionic/test-android.Dockerfile + context: . + args: + QT_VERSION: 5.13.2 + + bionic-android-514: + << : *linux + hostname: bionic-android + image: ${DOCKER_USER:-qbsbuild}/qbsdev:bionic-android-5.14.0-0 + build: + dockerfile: docker/bionic/test-android.Dockerfile + context: . + args: + QT_VERSION: 5.14.0 + stretch: << : *linux hostname: stretch diff --git a/docker/bionic/test-android.Dockerfile b/docker/bionic/test-android.Dockerfile new file mode 100644 index 000000000..ea7fde7a0 --- /dev/null +++ b/docker/bionic/test-android.Dockerfile @@ -0,0 +1,107 @@ +# +# Android SDK/NDK + Qt for Android for testing Qbs +# +FROM ubuntu:bionic +LABEL Description="Ubuntu test environment for Qbs and Qt 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/bionic/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 \ + 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}:\${PATH}" >> /etc/profile.d/android.sh + +ENV ANDROID_HOME="/home/${USER_NAME}/android" +ENV ANDROID_SDK_ROOT=${ANDROID_HOME} +ENV ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk-bundle +ENV PATH="${JAVA_HOME}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/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}/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 SDK TOOLS +ARG SDK_TOOLS_VERSION="4333796" +RUN curl -s https://dl.google.com/android/repository/sdk-tools-linux-${SDK_TOOLS_VERSION}.zip > ${ANDROID_HOME}/sdk.zip && \ + unzip ${ANDROID_HOME}/sdk.zip -d ${ANDROID_HOME} && \ + rm -v ${ANDROID_HOME}/sdk.zip + +# Accept SDK license +ARG ANDROID_PLATFORM="android-29" +ARG BUILD_TOOLS="28.0.3" +RUN yes | sdkmanager --verbose --licenses && \ + sdkmanager --update && \ + sdkmanager "platforms;${ANDROID_PLATFORM}" "build-tools;${BUILD_TOOLS}" "platform-tools" "tools" "ndk-bundle" && \ + /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 + +USER root + +# +# Install Qt and Qbs for Linux from qt.io +# +ARG QT_VERSION +COPY scripts/install-qt.sh install-qt.sh +RUN if [ "${QT_VERSION}" \< "5.14" ]; then \ + QT_ABIS="android_armv7 android_arm64_v8a android_x86 android_x86_64"; \ + else \ + QT_ABIS="any"; \ + fi; \ + for abi in ${QT_ABIS}; do \ + ./install-qt.sh --version ${QT_VERSION} --target android --toolchain ${abi} qtbase qtdeclarative qttools qtimageformats; \ + done && \ + echo "export QT_VERSION=${QT_VERSION}" >> /etc/profile.d/qt.sh + diff --git a/scripts/test-qt-for-android.sh b/scripts/test-qt-for-android.sh new file mode 100755 index 000000000..877afbc30 --- /dev/null +++ b/scripts/test-qt-for-android.sh @@ -0,0 +1,65 @@ +#!/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" + +# +# These are set outside of this script, for instance in the Docker image +# +QT_INSTALL_DIR=/opt/Qt/${QT_VERSION} +echo "Android SDK installed at ${ANDROID_SDK_ROOT}" +echo "Android NDK installed at ${ANDROID_NDK_ROOT}" +echo "Qt installed at ${QT_INSTALL_DIR}" + +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 config --unset profiles.qbs_autotests-android-qt.qbs.architectures +qbs config profiles.qbs_autotests-android-qt.qbs.architecture armv7a + +qbs config --list + +export QBS_AUTOTEST_PROFILE=qbs_autotests-android +export QBS_AUTOTEST_ALWAYS_LOG_STDERR=true + +tst_blackbox-android + diff --git a/tests/auto/blackbox/testdata-android/minimal-native/src/main/native/native.c b/tests/auto/blackbox/testdata-android/minimal-native/src/main/native/native.c index 6b625858b..f49b4f90f 100644 --- a/tests/auto/blackbox/testdata-android/minimal-native/src/main/native/native.c +++ b/tests/auto/blackbox/testdata-android/minimal-native/src/main/native/native.c @@ -4,5 +4,6 @@ jstring Java_minimalnative_MinimalNative_stringFromNative(JNIEnv* env, jobject thiz) { + (void)thiz; return (*env)->NewStringUTF(env, "This message comes from native code."); } diff --git a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/AndroidManifest.xml b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/AndroidManifest.xml index 289969409..272fe55de 100644 --- a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/AndroidManifest.xml +++ b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.qt.dummy1" android:versionCode="1" android:versionName="1.0"> - <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/> + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> <uses-feature android:glEsVersion="0x00020000"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:allowBackup="true" android:hasCode="true"> diff --git a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/AndroidManifest.xml b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/AndroidManifest.xml index ef0fbe54f..871aadbe6 100644 --- a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/AndroidManifest.xml +++ b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.qt.dummy2" android:versionCode="1" android:versionName="1.0"> - <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/> + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> <uses-feature android:glEsVersion="0x00020000"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:allowBackup="true" android:hasCode="true"> diff --git a/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/AndroidManifest.xml b/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/AndroidManifest.xml index 6694afc18..f184a8f1f 100644 --- a/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/AndroidManifest.xml +++ b/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.qt.dummy" android:versionCode="1" android:versionName="1.0"> - <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="19"/> + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> <uses-feature android:glEsVersion="0x00020000"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:allowBackup="true" android:hasCode="true"> diff --git a/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml b/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml index 066ec0a63..542794825 100644 --- a/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml +++ b/tests/auto/blackbox/testdata-android/qml-app/src/main/AndroidManifest.xml @@ -67,7 +67,7 @@ </application> - <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/> + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. |