From e8b186610738a16fe8ddaacd39797d863828c7aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cotty?= Date: Fri, 16 Oct 2020 22:44:41 +0200 Subject: Android: Update for Qt 6 Manage the new directory layout of Qt6. Update generation of the input file for androiddeployqt. Fixes: QBS-1613 Fixes: QBS-1609 Change-Id: Ie633fad467f310bfc4cd42e9c32d9cfc2e734582 Reviewed-by: Ivan Komissarov --- docker-compose.yml | 16 +- docker/focal/test-android.Dockerfile | 10 +- scripts/install-qt.sh | 22 +- scripts/test-qt-for-android.sh | 4 +- share/qbs/module-providers/Qt/setup-qt.js | 5 +- .../Qt/templates/android_support.qbs | 34 ++- share/qbs/module-providers/Qt/templates/core.qbs | 9 +- share/qbs/module-providers/Qt/templates/qml.qbs | 4 +- tests/auto/blackbox/tst_blackboxandroid.cpp | 243 ++++++++++++++------- 9 files changed, 255 insertions(+), 92 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4e8112bf9..83f629e44 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: focal-android-513: << : *linux hostname: focal-android - image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.13.2-0 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.13.2-1 build: dockerfile: docker/focal/test-android.Dockerfile context: . @@ -41,7 +41,7 @@ services: focal-android-514: << : *linux hostname: focal-android - image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.14.0-0 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.14.0-1 build: dockerfile: docker/focal/test-android.Dockerfile context: . @@ -51,13 +51,23 @@ services: focal-android-515: << : *linux hostname: focal-android - image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.15.1-0 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-5.15.1-1 build: dockerfile: docker/focal/test-android.Dockerfile context: . args: QT_VERSION: 5.15.1 + focal-android-600: + << : *linux + hostname: focal-android + image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-android-6.0.0-0 + build: + dockerfile: docker/focal/test-android.Dockerfile + context: . + args: + QT_VERSION: 6.0.0 + focal-baremetal: << : *linux hostname: focal-baremetal diff --git a/docker/focal/test-android.Dockerfile b/docker/focal/test-android.Dockerfile index a012f504f..8ded72c37 100644 --- a/docker/focal/test-android.Dockerfile +++ b/docker/focal/test-android.Dockerfile @@ -101,12 +101,18 @@ USER root # ARG QT_VERSION COPY scripts/install-qt.sh install-qt.sh -RUN if [ "${QT_VERSION}" \< "5.14" ]; then \ +RUN if [ "${QT_VERSION}" \< "5.14" ] || [ ! "${QT_VERSION}" \< "6.0.0" ]; then \ QT_ABIS="android_armv7 android_arm64_v8a android_x86 android_x86_64"; \ else \ QT_ABIS="any"; \ fi; \ + if [ ! "${QT_VERSION}" \< "6.0.0" ]; then \ + ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative icu; \ + QT_COMPONENTS="qtbase qtdeclarative qttools qtquickcontrols2 qtquicktimeline"; \ + else \ + QT_COMPONENTS="qtbase qtdeclarative qttools qtimageformats"; \ + fi; \ for abi in ${QT_ABIS}; do \ - ./install-qt.sh --version ${QT_VERSION} --target android --toolchain ${abi} qtbase qtdeclarative qttools qtimageformats; \ + ./install-qt.sh --version ${QT_VERSION} --target android --toolchain ${abi} ${QT_COMPONENTS}; \ done && \ echo "export QT_VERSION=${QT_VERSION}" >> /etc/profile.d/qt.sh diff --git a/scripts/install-qt.sh b/scripts/install-qt.sh index a73300ae4..f029b62c2 100755 --- a/scripts/install-qt.sh +++ b/scripts/install-qt.sh @@ -231,6 +231,7 @@ function compute_url(){ local COMPONENT=$1 local CURL="curl -s -L" local BASE_URL="http://download.qt.io/online/qtsdkrepository/${HOST_OS}/${TARGET_PLATFORM}" + local ANDROID_ARCH=$(echo ${TOOLCHAIN##android_}) if [[ "${COMPONENT}" =~ "qtcreator" ]]; then @@ -244,6 +245,10 @@ function compute_url(){ else REMOTE_BASES=( + # New repository format (>=6.0.0) + "qt6_${VERSION//./}/qt.qt6.${VERSION//./}.${TOOLCHAIN}" + "qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${TOOLCHAIN}" + "qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" # New repository format (>=5.9.6) "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${TOOLCHAIN}" "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" @@ -274,7 +279,7 @@ rm -f "${HASH_FILEPATH}" for COMPONENT in ${COMPONENTS}; do URL="$(compute_url ${COMPONENT})" - echo "Downloading ${COMPONENT}..." >&2 + echo "Downloading ${COMPONENT} ${URL}..." >&2 curl --progress-bar -L -o ${DOWNLOAD_DIR}/package.7z ${URL} >&2 7z x -y -o${INSTALL_DIR} ${DOWNLOAD_DIR}/package.7z >/dev/null 2>&1 7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${INSTALL_DIR}/|p" >> "${HASH_FILEPATH}" 2>/dev/null @@ -298,9 +303,18 @@ for COMPONENT in ${COMPONENTS}; do SUBDIR="${TOOLCHAIN}" fi - CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf" - echo "[Paths]" > ${CONF_FILE} - echo "Prefix = .." >> ${CONF_FILE} + if [ "${TARGET_PLATFORM}" == "android" ] && [ ! "${QT_VERSION}" \< "6.0.0" ]; then + CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/target_qt.conf" + sed -i "s|target|../$TOOLCHAIN|g" "${CONF_FILE}" + sed -i "/HostPrefix/ s|$|gcc_64|g" "${CONF_FILE}" + ANDROID_QMAKE_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qmake" + QMAKE_FILE="${INSTALL_DIR}/${VERSION}/gcc_64/bin/qmake" + sed -i "s|\/home\/qt\/work\/install\/bin\/qmake|$QMAKE_FILE|g" "${ANDROID_QMAKE_FILE}" + else + CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf" + echo "[Paths]" > ${CONF_FILE} + echo "Prefix = .." >> ${CONF_FILE} + fi # Adjust the license to be able to run qmake # sed with -i requires intermediate file on Mac OS diff --git a/scripts/test-qt-for-android.sh b/scripts/test-qt-for-android.sh index 06d89cedf..793ba248d 100755 --- a/scripts/test-qt-for-android.sh +++ b/scripts/test-qt-for-android.sh @@ -63,8 +63,8 @@ qbs setup-android --ndk-dir ${ANDROID_HOME}/ndk-bundle --sdk-dir ${ANDROID_HOME} export QBS_AUTOTEST_PROFILE=qbs_autotests-android export QBS_AUTOTEST_ALWAYS_LOG_STDERR=true -if [ ! "${QT_VERSION}" \< "5.14.0" ]; then - echo "Using multi-arch data sets for qml tests (only for qt version >= 5.14) with all architectures" +if [ ! "${QT_VERSION}" \< "5.14.0" ] && [ "${QT_VERSION}" \< "6.0.0" ]; then + echo "Using multi-arch data sets for qml tests (only for qt version >= 5.14 and < 6.0.0) with all architectures" qbs config --list tst_blackbox-android diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index c7b722563..a50770b18 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -246,8 +246,8 @@ function getQtProperties(qmakeFilePath, qbs) { qtProps.includePath = pathQueryValue(queryResult, "QT_INSTALL_HEADERS"); qtProps.libraryPath = pathQueryValue(queryResult, "QT_INSTALL_LIBS"); qtProps.hostLibraryPath = pathQueryValue(queryResult, "QT_HOST_LIBS"); - qtProps.binaryPath = pathQueryValue(queryResult, "QT_HOST_BINS") - || pathQueryValue(queryResult, "QT_INSTALL_BINS"); + qtProps.binaryPath = pathQueryValue(queryResult, "QT_HOST_BINS"); + qtProps.installPath = pathQueryValue(queryResult, "QT_INSTALL_BINS"); qtProps.documentationPath = pathQueryValue(queryResult, "QT_INSTALL_DOCS"); qtProps.pluginPath = pathQueryValue(queryResult, "QT_INSTALL_PLUGINS"); qtProps.qmlPath = pathQueryValue(queryResult, "QT_INSTALL_QML"); @@ -1329,6 +1329,7 @@ function replaceSpecialValues(content, module, qtProps, abi) { config: ModUtils.toJSLiteral(qtProps.configItems), qtConfig: ModUtils.toJSLiteral(qtProps.qtConfigItems), binPath: ModUtils.toJSLiteral(qtProps.binaryPath), + installPath: ModUtils.toJSLiteral(qtProps.installPath), libPath: ModUtils.toJSLiteral(qtProps.libraryPath), pluginPath: ModUtils.toJSLiteral(qtProps.pluginPath), incPath: ModUtils.toJSLiteral(qtProps.includePath), diff --git a/share/qbs/module-providers/Qt/templates/android_support.qbs b/share/qbs/module-providers/Qt/templates/android_support.qbs index 1deedb0a7..bdbb0e43b 100644 --- a/share/qbs/module-providers/Qt/templates/android_support.qbs +++ b/share/qbs/module-providers/Qt/templates/android_support.qbs @@ -15,8 +15,9 @@ Module { property stringList extraLibs // qmake: ANDROID_EXTRA_LIBS property bool verboseAndroidDeployQt: false - property string _androidDeployQtFilePath: FileInfo.joinPaths(_qtInstallDir, "bin", + property string _androidDeployQtFilePath: FileInfo.joinPaths(_qtBinaryDir, "bin", "androiddeployqt") + property string _qtBinaryDir property string _qtInstallDir // TODO: Remove in 1.20 // From 1.20 product property used from an export item will point to the @@ -54,8 +55,13 @@ Module { } Properties { condition: _enableSdkSupport && Utilities.versionCompare(version, "5.15") >= 0 + && Utilities.versionCompare(version, "6.0") < 0 java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "QtAndroid.jar")] } + Properties { + condition: _enableSdkSupport && Utilities.versionCompare(version, "6.0") >= 0 + java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "Qt6Android.jar")] + } Properties { condition: _enableNdkSupport && (Android.ndk.abi === "armeabi-v7a" || Android.ndk.abi === "x86") cpp.defines: "ANDROID_HAS_WSTRING" @@ -65,11 +71,19 @@ Module { Android.sdk._archInName: _multiAbi Android.sdk._bundledInAssets: _multiAbi } + Properties { + condition: _enableSdkSupport && Utilities.versionCompare(version, "6.0") < 0 + Android.sdk.minimumVersion: "21" + } + Properties { + condition: _enableSdkSupport && Utilities.versionCompare(version, "6.0") >= 0 + Android.sdk.minimumVersion: "23" + } Rule { condition: _enableSdkSupport multiplex: true - property stringList inputTags: "android.nativelibrary" + property stringList inputTags: ["android.nativelibrary", "qrc"] inputsFromDependencies: inputTags inputs: product.aggregate ? [] : inputTags Artifact { @@ -180,6 +194,21 @@ Module { if (Array.isArray(product.qmlImportPaths) && product.qmlImportPaths.length > 0) f.writeLine('"qml-import-paths": "' + product.qmlImportPaths.join(',') + '",'); + if (Utilities.versionCompare(product.Qt.android_support.version, "6.0") >= 0) { + f.writeLine('"qml-importscanner-binary": "' + + product.Qt.core.qmlImportScannerFilePath + '",'); + f.writeLine('"rcc-binary": "' + product.Qt.core.binPath + '/rcc' + '",'); + + if (inputs["qrc"] && inputs["qrc"].length > 0) { + var qrcFiles = []; + var qrcInputs = inputs["qrc"]; + for (i = 0; i < qrcInputs.length; ++i) { + qrcFiles.push(qrcInputs[i].filePath); + } + f.writeLine('"qrcFiles": "' + qrcFiles.join(',') + '",'); + } + } + // QBS-1429 if (!product.Qt.android_support._multiAbi) { f.writeLine('"stdcpp-path": "' + (product.cpp.sharedStlFilePath @@ -191,6 +220,7 @@ Module { '/toolchains/llvm/prebuilt/' + hostArch + '/sysroot/usr/lib/",'); f.writeLine('"application-binary": "' + theBinary.product.targetName + '"'); } + f.writeLine("}"); f.close(); }; diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index 10359e751..113f868cf 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -21,9 +21,15 @@ Module { Depends { name: "Qt.android_support"; condition: qbs.targetOS.contains("android") } Properties { condition: qbs.targetOS.contains("android") - Qt.android_support._qtInstallDir: FileInfo.path(binPath) + Qt.android_support._qtBinaryDir: FileInfo.path(binPath) + Qt.android_support._qtInstallDir: FileInfo.path(installPath) Qt.android_support.version: version } + // qmlImportScanner is required by androiddeployqt even if the project doesn't + // depend on qml. That's why the scannerName must be defined here and not in the + // qml module + property string qmlImportScannerName: "qmlimportscanner" + property string qmlImportScannerFilePath: binPath + '/' + qmlImportScannerName version: @version@ property stringList architectures: @archs@ @@ -32,6 +38,7 @@ Module { property stringList config: @config@ property stringList qtConfig: @qtConfig@ property path binPath: @binPath@ + property path installPath: @installPath@ property path incPath: @incPath@ property path libPath: @libPath@ property path pluginPath: @pluginPath@ diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs index c63937649..f608ba4dd 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -6,8 +6,8 @@ QtModule { qtModuleName: "Qml" Depends { name: "Qt"; submodules: @dependencies@} - property string qmlImportScannerName: "qmlimportscanner" - property string qmlImportScannerFilePath: Qt.core.binPath + '/' + qmlImportScannerName + property string qmlImportScannerName: Qt.core.qmlImportScannerName + property string qmlImportScannerFilePath: Qt.core.qmlImportScannerFilePath property string qmlPath: @qmlPath@ property bool generateCacheFiles: false diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp index f3d960ece..291960792 100644 --- a/tests/auto/blackbox/tst_blackboxandroid.cpp +++ b/tests/auto/blackbox/tst_blackboxandroid.cpp @@ -221,10 +221,10 @@ void TestBlackboxAndroid::android_data() qbs::Version version(5, 13); QStringList qmakeFilePaths = pQt.value(QStringLiteral("moduleProviders.Qt.qmakeFilePaths")). toStringList(); - if (qmakeFilePaths.size() == 1) + if (qmakeFilePaths.size() >= 1) version = TestBlackboxBase::qmakeVersion(qmakeFilePaths[0]); bool singleArchQt = (version < qbs::Version(5, 14)); - + QByteArray qtVersionMajor((version >= qbs::Version(6, 0)) ? "6" : "5"); QByteArrayList archsForQt; if (singleArchQt) { archsForQt = { pQt.value("qbs.architecture").toString().toUtf8() }; @@ -294,7 +294,7 @@ void TestBlackboxAndroid::android_data() bool generateAab = false; bool isIncrementalBuild = false; - auto qtAppExpectedFiles = [&](bool generateAab) { + auto qtAppExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { @@ -318,30 +318,36 @@ void TestBlackboxAndroid::android_data() expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { cxxLibPath("libgnustl_shared.so", true), "lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qjpeg_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so", "lib/${ARCH}/libplugins_platforms_qtforandroid_${ARCH}.so", - "lib/${ARCH}/libplugins_styles_qandroidstyle_${ARCH}.so", - "lib/${ARCH}/libQt5Core_${ARCH}.so", - "lib/${ARCH}/libQt5Gui_${ARCH}.so", - "lib/${ARCH}/libQt5Widgets_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Core_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Gui_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Widgets_${ARCH}.so", "lib/${ARCH}/libqt-app_${ARCH}.so"}, generateAab); } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; + if (version >= qbs::Version(5, 14)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libplugins_styles_qandroidstyle_${ARCH}.so"}, generateAab); + if (version < qbs::Version(6, 0) && version >= qbs::Version(5, 14)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); + if (!enableAapt2 && version < qbs::Version(6, 0)) + expectedFile << "res/layout/splash.xml"; return expectedFile; }; QTest::newRow("qt app") << "qt-app" << QStringList("qt-app") - << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab) - << "res/layout/splash.xml")) + << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, + enableAapt2))) << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild; @@ -418,7 +424,7 @@ void TestBlackboxAndroid::android_data() "modules.qbs.architecture:" + archsStringList.first(), aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild; - auto qmlAppExpectedFiles = [&](bool generateAab) { + auto qmlAppExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { @@ -462,15 +468,9 @@ void TestBlackboxAndroid::android_data() expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { "assets/android_rcc_bundle.rcc", cxxLibPath("libgnustl_shared.so", true), - "lib/${ARCH}/libplugins_bearer_qandroidbearer_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qjpeg_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so", "lib/${ARCH}/libplugins_platforms_qtforandroid_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_debugger_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_inspector_${ARCH}.so", @@ -483,34 +483,80 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libplugins_qmltooling_qmldbg_quickprofiler_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_server_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_tcp_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick.2_qtquick2plugin_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick_Window.2_windowplugin_${ARCH}.so", - "lib/${ARCH}/libQt5Core_${ARCH}.so", - "lib/${ARCH}/libQt5Gui_${ARCH}.so", - "lib/${ARCH}/libQt5Network_${ARCH}.so", - "lib/${ARCH}/libQt5Qml_${ARCH}.so", - "lib/${ARCH}/libQt5Quick_${ARCH}.so", - "lib/${ARCH}/libQt5QmlModels_${ARCH}.so", - "lib/${ARCH}/libQt5QmlWorkerScript_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Core_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Gui_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Network_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Qml_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Quick_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "QmlModels_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "QmlWorkerScript_${ARCH}.so", "lib/${ARCH}/libqmlapp_${ARCH}.so"}, generateAab); if (version < qbs::Version(5, 15)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libQt5QuickParticles_${ARCH}.so"}, generateAab); - if (version >= qbs::Version(5, 15)) + if (version >= qbs::Version(5, 15) && version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_StateMachine_qtqmlstatemachine_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript.2_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_Models.2_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(5, 14) && version < qbs::Version(6, 0)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libqml_QtQuick.2_qtquick2plugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Window.2_windowplugin_${ARCH}.so"}, + generateAab); + if (version < qbs::Version(6, 0)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libplugins_bearer_qandroidbearer_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(6, 0)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libQt6OpenGL_${ARCH}.so", + "lib/${ARCH}/libQt6QuickControls2Impl_${ARCH}.so", + "lib/${ARCH}/libQt6QuickControls2_${ARCH}.so", + "lib/${ARCH}/libQt6QuickParticles_${ARCH}.so", + "lib/${ARCH}/libQt6QuickShapes_${ARCH}.so", + "lib/${ARCH}/libQt6QuickTemplates2_${ARCH}.so", + "lib/${ARCH}/libQt6Sql_${ARCH}.so", + "lib/${ARCH}/libplugins_sqldrivers_qsqlite_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_Models_modelsplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_WorkerScript_workerscriptplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_qtquickcontrols2plugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_LocalStorage_qmllocalstorageplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_NativeStyle_qtquickcontrols2nativestyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Particles_particlesplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Shapes_qmlshapesplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Templates_qtquicktemplates2plugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Timeline_qtquicktimelineplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Layouts_qquicklayoutsplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_qtquick2plugin_${ARCH}.so"}, generateAab); } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; + if (!enableAapt2 && version < qbs::Version(6, 0)) + expectedFile << "res/layout/splash.xml"; return expectedFile; }; - auto qmlAppMinistroExpectedFiles = [&](bool generateAab) { + auto qmlAppMinistroExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { @@ -527,9 +573,11 @@ void TestBlackboxAndroid::android_data() expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; + if (!enableAapt2 && version < qbs::Version(6, 0)) + expectedFile << "res/layout/splash.xml"; return expectedFile; }; - auto qmlAppCustomMetaDataExpectedFiles = [&](bool generateAab) { + auto qmlAppCustomMetaDataExpectedFiles = [&](bool generateAab, bool enableAapt2) { QByteArrayList expectedFile; if (singleArchQt) { expectedFile << commonFiles(generateAab) + expandArchs(ndkArchsForQt, { @@ -575,15 +623,9 @@ void TestBlackboxAndroid::android_data() "assets/android_rcc_bundle.rcc", "assets/dummyasset.txt", cxxLibPath("libgnustl_shared.so", true), - "lib/${ARCH}/libplugins_bearer_qandroidbearer_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qgif_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qico_${ARCH}.so", "lib/${ARCH}/libplugins_imageformats_qjpeg_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", - "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so", "lib/${ARCH}/libplugins_platforms_qtforandroid_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_debugger_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_inspector_${ARCH}.so", @@ -596,30 +638,76 @@ void TestBlackboxAndroid::android_data() "lib/${ARCH}/libplugins_qmltooling_qmldbg_quickprofiler_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_server_${ARCH}.so", "lib/${ARCH}/libplugins_qmltooling_qmldbg_tcp_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick.2_qtquick2plugin_${ARCH}.so", - "lib/${ARCH}/libqml_QtQuick_Window.2_windowplugin_${ARCH}.so", - "lib/${ARCH}/libQt5Core_${ARCH}.so", - "lib/${ARCH}/libQt5Gui_${ARCH}.so", - "lib/${ARCH}/libQt5Network_${ARCH}.so", - "lib/${ARCH}/libQt5Qml_${ARCH}.so", - "lib/${ARCH}/libQt5Quick_${ARCH}.so", - "lib/${ARCH}/libQt5QmlModels_${ARCH}.so", - "lib/${ARCH}/libQt5QmlWorkerScript_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Core_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Gui_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Network_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Qml_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "Quick_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "QmlModels_${ARCH}.so", + "lib/${ARCH}/libQt" + qtVersionMajor + "QmlWorkerScript_${ARCH}.so", "lib/${ARCH}/libqmlapp_${ARCH}.so"}, generateAab); if (version < qbs::Version(5, 15)) expectedFile << expandArchs(ndkArchsForQt, { - "lib/${ARCH}/libQt5QuickParticles_${ARCH}.so"}, generateAab); - if (version >= qbs::Version(5, 15)) + "lib/${ARCH}/libQt5QuickParticles_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(5, 15) && version < qbs::Version(6, 0)) expectedFile << expandArchs(ndkArchsForQt, { "lib/${ARCH}/libqml_QtQml_StateMachine_qtqmlstatemachine_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_WorkerScript.2_workerscriptplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_Models.2_modelsplugin_${ARCH}.so", "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(5, 14) && version < qbs::Version(6, 0)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libqml_QtQuick.2_qtquick2plugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Window.2_windowplugin_${ARCH}.so"}, + generateAab); + if (version < qbs::Version(6, 0)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libplugins_bearer_qandroidbearer_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qicns_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qtga_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qtiff_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qwbmp_${ARCH}.so", + "lib/${ARCH}/libplugins_imageformats_qwebp_${ARCH}.so"}, generateAab); + if (version >= qbs::Version(6, 0)) + expectedFile << expandArchs(ndkArchsForQt, { + "lib/${ARCH}/libQt6OpenGL_${ARCH}.so", + "lib/${ARCH}/libQt6QuickControls2Impl_${ARCH}.so", + "lib/${ARCH}/libQt6QuickControls2_${ARCH}.so", + "lib/${ARCH}/libQt6QuickParticles_${ARCH}.so", + "lib/${ARCH}/libQt6QuickShapes_${ARCH}.so", + "lib/${ARCH}/libQt6QuickTemplates2_${ARCH}.so", + "lib/${ARCH}/libQt6Sql_${ARCH}.so", + "lib/${ARCH}/libplugins_sqldrivers_qsqlite_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_Models_modelsplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_WorkerScript_workerscriptplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQml_qmlplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Basic_impl_qtquickcontrols2basicstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Basic_qtquickcontrols2basicstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_impl_qtquickcontrols2fusionstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Fusion_qtquickcontrols2fusionstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_impl_qtquickcontrols2imaginestyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Imagine_qtquickcontrols2imaginestyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Material_impl_qtquickcontrols2materialstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Material_qtquickcontrols2materialstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Universal_impl_qtquickcontrols2universalstyleimplplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_Universal_qtquickcontrols2universalstyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_impl_qtquickcontrols2implplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Controls_qtquickcontrols2plugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_LocalStorage_qmllocalstorageplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_NativeStyle_qtquickcontrols2nativestyleplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Particles_particlesplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Shapes_qmlshapesplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Templates_qtquicktemplates2plugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Timeline_qtquicktimelineplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_Layouts_qquicklayoutsplugin_${ARCH}.so", + "lib/${ARCH}/libqml_QtQuick_qtquick2plugin_${ARCH}.so"}, generateAab); } if (generateAab) expectedFile << "base/resources.pb" << "base/assets.pb" << "base/native.pb"; else expectedFile << "resources.arsc"; + if (!enableAapt2 && version < qbs::Version(6, 0)) + expectedFile << "res/layout/splash.xml"; return expectedFile; }; QStringList qmlAppCustomProperties; @@ -642,8 +730,7 @@ void TestBlackboxAndroid::android_data() generateAab = false; QTest::newRow("qml app") << "qml-app" << QStringList("qmlapp") - << (QList() << (QByteArrayList() << qmlAppExpectedFiles(generateAab) - << "res/layout/splash.xml")) + << (QList() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild; @@ -651,14 +738,14 @@ void TestBlackboxAndroid::android_data() enableAapt2 = true; QTest::newRow("qml app aapt2") << "qml-app" << QStringList("qmlapp") - << (QList() << qmlAppExpectedFiles(generateAab)) + << (QList() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild; generateAab = true; QTest::newRow("qml app aab") << "qml-app" << QStringList("qmlapp") - << (QList() << qmlAppExpectedFiles(generateAab)) + << (QList() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild; @@ -668,8 +755,8 @@ void TestBlackboxAndroid::android_data() QTest::newRow("qml app using Ministro") << "qml-app" << QStringList("qmlapp") << (QList() << (QByteArrayList() - << qmlAppMinistroExpectedFiles(generateAab) - << "res/layout/splash.xml")) + << qmlAppMinistroExpectedFiles(generateAab, + enableAapt2))) << (QStringList() << "modules.Qt.android_support.useMinistro:true" << "modules.Android.sdk.automaticSources:false" << aaptVersion(enableAapt2) << packageType(generateAab)) @@ -677,26 +764,30 @@ void TestBlackboxAndroid::android_data() enableAapt2 = true; QTest::newRow("qml app using Ministro aapt2") << "qml-app" << QStringList("qmlapp") - << (QList() << qmlAppMinistroExpectedFiles(generateAab)) + << (QList() << qmlAppMinistroExpectedFiles(generateAab, + enableAapt2)) << (QStringList() << "modules.Qt.android_support.useMinistro:true" << "modules.Android.sdk.automaticSources:false" << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild; generateAab = true; - QTest::newRow("qml app using Ministro aab") - << "qml-app" << QStringList("qmlapp") - << (QList() << qmlAppMinistroExpectedFiles(generateAab)) - << (QStringList() << "modules.Qt.android_support.useMinistro:true" - << "modules.Android.sdk.automaticSources:false" << aaptVersion(enableAapt2) - << packageType(generateAab)) - << enableAapt2 << generateAab << isIncrementalBuild; + if (!singleArchQt) { + QTest::newRow("qml app using Ministro aab") + << "qml-app" << QStringList("qmlapp") + << (QList() << qmlAppMinistroExpectedFiles(generateAab, + enableAapt2)) + << (QStringList() << "modules.Qt.android_support.useMinistro:true" + << "modules.Android.sdk.automaticSources:false" << aaptVersion(enableAapt2) + << packageType(generateAab)) + << enableAapt2 << generateAab << isIncrementalBuild; + } enableAapt2 = false; generateAab = false; QTest::newRow("qml app with custom metadata") << "qml-app" << QStringList("qmlapp") << (QList() << (QByteArrayList() - << qmlAppCustomMetaDataExpectedFiles(generateAab) - << "res/layout/splash.xml")) + << qmlAppCustomMetaDataExpectedFiles(generateAab, + enableAapt2))) << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild; @@ -704,18 +795,22 @@ void TestBlackboxAndroid::android_data() QTest::newRow("qml app with custom metadata aapt2") << "qml-app" << QStringList("qmlapp") << (QList() << (QByteArrayList() - << qmlAppCustomMetaDataExpectedFiles(generateAab))) + << qmlAppCustomMetaDataExpectedFiles(generateAab, + enableAapt2))) << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild; generateAab = true; - QTest::newRow("qml app with custom metadata aab") - << "qml-app" << QStringList("qmlapp") - << (QList() << (QByteArrayList() - << qmlAppCustomMetaDataExpectedFiles(generateAab))) - << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), - packageType(generateAab)} - << enableAapt2 << generateAab << isIncrementalBuild; + if (!singleArchQt) { + QTest::newRow("qml app with custom metadata aab") + << "qml-app" << QStringList("qmlapp") + << (QList() << (QByteArrayList() + << qmlAppCustomMetaDataExpectedFiles(generateAab, + enableAapt2))) + << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), + packageType(generateAab)} + << enableAapt2 << generateAab << isIncrementalBuild; + } isIncrementalBuild = false; enableAapt2 = false; generateAab = false; -- cgit v1.2.3