diff options
24 files changed, 420 insertions, 238 deletions
diff --git a/.github/actions/download-qtc/action.yml b/.github/actions/download-qtc/action.yml index 4afb56c53..3e201670b 100644 --- a/.github/actions/download-qtc/action.yml +++ b/.github/actions/download-qtc/action.yml @@ -4,7 +4,7 @@ inputs: version: description: 'Qt Creator version' required: false - default: '4.12.4' + default: '4.13.3' runs: using: "composite" steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 807b9faad..52ba5e372 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -130,7 +130,7 @@ jobs: - name: Install required packages run: | brew install ccache p7zip - /usr/bin/python3 -m pip install --user beautifulsoup4 lxml + python3 -m pip install --user beautifulsoup4 lxml - name: Install Qt uses: ./.github/actions/download-qt with: @@ -218,6 +218,49 @@ jobs: name: qbs-windows-${{ github.run_id }}.zip path: release/qbs-windows-${{ github.run_id }}.zip + build-windows-with-docker: + name: Build on Windows (Docker) + runs-on: windows-latest + timeout-minutes: 45 + env: + WITH_TESTS: 0 + QT_ASSUME_STDERR_HAS_CONSOLE: 1 + CLCACHE_DIR: C:\.ccache + steps: + - uses: actions/checkout@v1 + - name: Create .ccache dir + run: mkdir -p ~/.ccache + shell: bash + - name: prepare timestamp + id: get-timestamp + run: echo ::set-output name=timestamp::$(date -u +"%Y-%m-%dT%H:%M:%SZ") + shell: bash + - name: clcache cache files + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-msvc-docker-clcache-${{ steps.get-timestamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-msvc-docker-clcache- + - name: Pull the Windows Image + run: docker-compose pull windows + - name: Print clcache stats + run: docker-compose run --rm windows clcache -s + - name: Build Qbs + run: > + docker-compose run --rm windows qbs build + -p dist + qbs.buildVariant:release + modules.cpp.compilerWrapper:clcache + modules.qbsbuildconfig.enableBundledQt:true + modules.qbsbuildconfig.enableProjectFileUpdates:true + modules.qbsbuildconfig.enableUnitTests:true + modules.cpp.treatWarningsAsErrors:true + project.withDocumentation:true + config:release-64 profile:qt64 + config:release profile:qt + - name: Print clcache stats + run: docker-compose run --rm windows clcache -s + test-linux: name: ${{ matrix.config.name }} runs-on: ubuntu-latest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d813d0aac..000000000 --- a/.travis.yml +++ /dev/null @@ -1,103 +0,0 @@ -# -# Required environment variables in the travis config -# -# DOCKER_USERNAME -# -language: cpp - -git: - submodules: false - -env: - global: - - QT_INSTALL_DIR=~/Qt - - QT_VERSION=5.15.0 - - QTCREATOR_VERSION=4.12.4 - - QTEST_FUNCTION_TIMEOUT=9000000 - -cache: - directories: - - ${QT_INSTALL_DIR} - - ~/.ccache - -stages: - - name: Build Qbs and and run autotests - -jobs: - include: - - &build-on-macos - stage: Build Qbs and and run autotests - name: With Qbs on macOS (xcode 11.5) - os: osx - osx_image: xcode11.5 - addons: - homebrew: - packages: - - capnp - - ccache - - grpc - - icoutils - - makensis - - protobuf - - python3 - - p7zip - update: true - env: - # Address sanitizer slows autotests down too much. - # We would hit the maximum build time on Travis. - BUILD_OPTIONS="modules.qbsbuildconfig.enableAddressSanitizer:false modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true" - QMAKE_PATH=${QT_INSTALL_DIR}/${QT_VERSION}/clang_64/bin/qmake - PATH="${QT_INSTALL_DIR}/Qt Creator.app/Contents/MacOS:${PATH}" - QBS_BUILD_PROFILE=qt - before_install: - - ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QT_VERSION} qtbase qtdeclarative qttools qtscript qtscxml - - ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QTCREATOR_VERSION} qtcreator - # Hack to workaround the BinaryProbe bug - it prefers /usr/bin/python3 to the one found in PATH - # Older macs, however, do not have python3 in /usr/bin - - /usr/bin/python3 -m pip install --user beautifulsoup4 lxml || python3 -m pip install --user beautifulsoup4 lxml - before_script: - - ulimit -c unlimited -S # enable core dumps - script: - - ccache -s - - qbs setup-toolchains --detect - - qbs setup-qt ${QMAKE_PATH} qt - - qbs config profiles.qt.baseProfile xcode-macosx-x86_64 - - qbs config defaultProfile qt - - qbs config --list profiles - - scripts/build-qbs-with-qbs.sh - - ccache -s - # Find core dump and print traceback on failure - after_failure: - - | - for f in $(find /cores -maxdepth 1 -name 'core.*' -print); do - lldb --core $f --batch --one-line "bt" - done; - - - &build-on-windows-with-docker - stage: Build Qbs and and run autotests - name: With Qbs on Windows with Docker (Visual Studio 2017) - if: NOT branch =~ ^gerrit - os: windows - services: docker - env: - CLCACHE_DIR="${HOME}/.ccache" - before-install: - - curl -sLo "/c/Program Files/Docker/docker-compose.exe" https://github.com/docker/compose/releases/download/1.25.3/docker-compose-Windows-x86_64.exe - - docker-compose pull windows - before_script: - - docker-compose run --rm windows clcache -s - script: - - > - docker-compose run --rm windows qbs build - -p dist - qbs.buildVariant:release - modules.cpp.compilerWrapper:clcache - modules.qbsbuildconfig.enableBundledQt:true - modules.qbsbuildconfig.enableProjectFileUpdates:true - modules.qbsbuildconfig.enableUnitTests:true - modules.cpp.treatWarningsAsErrors:true - project.withDocumentation:true - config:release-64 profile:qt64 - config:release profile:qt - after_script: - - docker-compose run --rm windows clcache -s diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index 885ed6a72..217e41e7c 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -467,6 +467,52 @@ Regenerating the man page requires the \c help2man tool. + \section1 Building \QBS with СMake + + To build \QBS, enter the following commands: + + \code + mkdir build && cd build + cmake -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ .. + make + \endcode + + Where \c ${QT_DIR} is the directory where Qt is installed. Passing the \c Qt5_DIR option + is not necessary if \c qmake is present in \c PATH. + + Depending on your platform, you might use \c mingw32-make, \c nmake, or + \c jom instead of \c make. + + Alternatively, you can use the + \l{https://cmake.org/cmake/help/latest/generator/Ninja.html}{Ninja} generator: + \code + cmake -GNinja -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ .. + ninja + \endcode + + \section2 CMake Configure Options + + \QBS recognizes the following CMake options (passed to CMake in the form of \c{-DOPTION=value}) + to customize the build: + + \table + \header \li Option \li Notes \li Default value + \row \li WITH_TESTS \li Enable autotests. \li \c ON + \row \li WITH_UNIT_TESTS \li Enable additional autotests. \li \c OFF + \row \li WITH_PROJECT_FILE_UPDATES \li Enable API for updating project files. This + implies a dependency to the QtGui module. + \li \c OFF + \row \li INSTALL_PUBLIC_HEADERS \li Whether to install public headers. \li \c ON + \endtable + + \section2 Using ccache with CMake + + To enable using \l{https://ccache.dev}{ccache} when building \QBS, pass the following options + to CMake: + \code + cmake -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .. + \endcode + \section1 Building \QBS with QMake To build \QBS, enter the following command: diff --git a/doc/reference/items/convenience/application.qdoc b/doc/reference/items/convenience/application.qdoc index 01366c4f9..15b05515d 100644 --- a/doc/reference/items/convenience/application.qdoc +++ b/doc/reference/items/convenience/application.qdoc @@ -69,7 +69,7 @@ */ /*! - \qmlproperty string Application::installDebugInformation + \qmlproperty bool Application::installDebugInformation If \c{true}, the debug information will be installed to \l{Application::debugInformationInstallDir}{debugInformationInstallDir}. diff --git a/doc/reference/items/convenience/library.qdoc b/doc/reference/items/convenience/library.qdoc index 7b2ddc5eb..409af3f19 100644 --- a/doc/reference/items/convenience/library.qdoc +++ b/doc/reference/items/convenience/library.qdoc @@ -78,7 +78,7 @@ */ /*! - \qmlproperty string Library::installDebugInformation + \qmlproperty bool Library::installDebugInformation If \c{true}, the debug information will be installed to \l{Library::debugInformationInstallDir}{debugInformationInstallDir}. diff --git a/docker-compose.yml b/docker-compose.yml index 4e8112bf9..ef53a0fb0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ x-default-service: &linux - QBS_TEST_SOURCE_ROOT - WITH_ARCHIVE - WITH_TESTS + - CLCACHE_DIR volumes: - .:/qbs - ~/.ccache:/home/devel/.ccache @@ -31,7 +32,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-2 build: dockerfile: docker/focal/test-android.Dockerfile context: . @@ -41,7 +42,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-2 build: dockerfile: docker/focal/test-android.Dockerfile context: . @@ -51,13 +52,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-2 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-1 + 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..72c84ca0c 100644 --- a/docker/focal/test-android.Dockerfile +++ b/docker/focal/test-android.Dockerfile @@ -49,11 +49,11 @@ RUN echo "export JAVA_HOME=${JAVA_HOME}" > /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" +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}/tools/bin:\$PATH" >> /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 @@ -61,18 +61,18 @@ RUN echo "export ANDROID_HOME=/home/${USER_NAME}/android" >> /etc/profile.d/andr 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 +# 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="28.0.3" -RUN yes | sdkmanager --verbose --licenses && \ - sdkmanager --update && \ - sdkmanager "platforms;${ANDROID_PLATFORM}" "build-tools;${BUILD_TOOLS}" "platform-tools" "tools" "ndk-bundle" && \ +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}" "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 @@ -92,7 +92,7 @@ RUN mkdir ${ANDROID_SDK_ROOT}/samples && \ # Download buildtool to generate aab packages in ${ANDROID_SDK_ROOT} RUN cd ${ANDROID_SDK_ROOT} && \ - curl -sLO https://github.com/google/bundletool/releases/download/0.15.0/bundletool-all-0.15.0.jar + curl -sLO https://github.com/google/bundletool/releases/download/1.3.0/bundletool-all-1.3.0.jar USER root @@ -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 @@ -62,7 +62,6 @@ Project { Product { name: "continuous integration files" files: [ - ".travis.yml", ".clang-tidy", "docker-compose.yml", ".github/**/*.yml", diff --git a/scripts/install-qt.sh b/scripts/install-qt.sh index a73300ae4..f85ea157a 100755 --- a/scripts/install-qt.sh +++ b/scripts/install-qt.sh @@ -231,19 +231,22 @@ 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 - REMOTE_BASE="tools_qtcreator/qt.tools.qtcreator" - REMOTE_PATH="$(${CURL} ${BASE_URL}/${REMOTE_BASE}/ | grep -o -E "${VERSION}[0-9\-]*${COMPONENT}\.7z" | tail -1)" - - if [ ! -z "${REMOTE_PATH}" ]; then - echo "${BASE_URL}/${REMOTE_BASE}/${REMOTE_PATH}" - return 0 - fi + SHORT_VERSION=${VERSION%??} + BASE_URL="http://download.qt.io/official_releases/qtcreator" + REMOTE_PATH="${SHORT_VERSION}/${VERSION}/installer_source/${HOST_OS}/qtcreator.7z" + echo "${BASE_URL}/${REMOTE_PATH}" + return 0 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 +277,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 +301,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 @@ -316,7 +328,7 @@ for COMPONENT in ${COMPONENTS}; do if [ "${HOST_OS}" == "mac_x64" ]; then echo "${INSTALL_DIR}/Qt Creator.app/Contents/MacOS" else - echo "${INSTALL_DIR}/Tools/QtCreator/bin" + echo "${INSTALL_DIR}/bin" fi fi 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/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js index 5633b7d22..586564d73 100644 --- a/share/qbs/imports/qbs/ModUtils/utils.js +++ b/share/qbs/imports/qbs/ModUtils/utils.js @@ -638,10 +638,12 @@ function toJSLiteral(v) { function extractMacros(output) { var m = {}; output.trim().split(/\r?\n/g).map(function (line) { - if (!line.startsWith("#define")) + var prefix = "#define "; + if (!line.startsWith(prefix)) return; - var parts = line.split(" ", 3); - m[parts[1]] = parts[2]; + var index = line.indexOf(" ", prefix.length); + if (index !== -1) + m[line.substr(prefix.length, index - prefix.length)] = line.substr(index + 1); }); return m; } 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,9 +55,14 @@ 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..691e4b50c 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@ @@ -285,9 +292,13 @@ Module { property bool combineMocOutput: cpp.combineCxxSources property bool enableBigResources: false + // Product should not moc in the aggregate when multiplexing. + property bool enableMoc: !(product.multiplexed || product.aggregate) + || product.multiplexConfigurationId Rule { name: "QtCoreMocRuleCpp" + condition: enableMoc property string cppInput: cpp.combineCxxSources ? "cpp.combine" : "cpp" property string objcppInput: cpp.combineObjcxxSources ? "objcpp.combine" : "objcpp" inputs: [objcppInput, cppInput] @@ -299,6 +310,7 @@ Module { } Rule { name: "QtCoreMocRuleHpp" + condition: enableMoc inputs: "hpp" auxiliaryInputs: ["qt_plugin_metadata", "cpp", "objcpp"]; excludedInputs: "unmocable" 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/share/qbs/modules/Android/sdk/sdk.qbs b/share/qbs/modules/Android/sdk/sdk.qbs index 32aae89d9..b3f977689 100644 --- a/share/qbs/modules/Android/sdk/sdk.qbs +++ b/share/qbs/modules/Android/sdk/sdk.qbs @@ -55,7 +55,7 @@ Module { platformSearchPaths: [Android.sdk.sdkDir] names: ["bundletool-all"] nameSuffixes: ["-0.11.0.jar", "-0.12.0.jar", "-0.13.0.jar", "-0.13.3.jar", "-0.13.4.jar", - "-0.14.0.jar", "-0.15.0.jar"] + "-0.14.0.jar", "-0.15.0.jar", "-1.0.0.jar", "-1.1.0.jar", "-1.2.0.jar", "-1.3.0.jar"] } property path sdkDir: sdkProbe.path diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 22eb53441..f1c41fe64 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -412,12 +412,9 @@ function dumpDefaultPaths(compilerFilePath, tag) { if (pass === 1) continue; - var parts = output.substring(startQuoteIndex + 1, endQuoteIndex).split("\n"); - var includePath = ""; - for (var i in parts) - includePath += parts[i].trim(); - - includePaths.push(includePath); + var path = output.substring(startQuoteIndex + 1, endQuoteIndex) + .replace(/[\s]{2,}/g, ' '); + includePaths.push(path); } return { diff --git a/tests/auto/blackbox/testdata-android/qt-app/MainWindow.cpp b/tests/auto/blackbox/testdata-android/qt-app/MainWindow.cpp new file mode 100644 index 000000000..b2e08c83e --- /dev/null +++ b/tests/auto/blackbox/testdata-android/qt-app/MainWindow.cpp @@ -0,0 +1,11 @@ +#include "MainWindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ +} + +MainWindow::~MainWindow() +{ +} + diff --git a/tests/auto/blackbox/testdata-android/qt-app/MainWindow.h b/tests/auto/blackbox/testdata-android/qt-app/MainWindow.h new file mode 100644 index 000000000..ace53a4a0 --- /dev/null +++ b/tests/auto/blackbox/testdata-android/qt-app/MainWindow.h @@ -0,0 +1,15 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); +}; + +#endif // MAINWINDOW_H diff --git a/tests/auto/blackbox/testdata-android/qt-app/main.cpp b/tests/auto/blackbox/testdata-android/qt-app/main.cpp index 6278e2924..0a0916fca 100644 --- a/tests/auto/blackbox/testdata-android/qt-app/main.cpp +++ b/tests/auto/blackbox/testdata-android/qt-app/main.cpp @@ -1,10 +1,11 @@ -#include <QMainWindow> +#include "MainWindow.h" + #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); - QMainWindow w; + MainWindow w; w.show(); - return 0; + return a.exec(); } diff --git a/tests/auto/blackbox/testdata-android/qt-app/qt-app.qbs b/tests/auto/blackbox/testdata-android/qt-app/qt-app.qbs index ceeda2dc3..981c9eb3d 100644 --- a/tests/auto/blackbox/testdata-android/qt-app/qt-app.qbs +++ b/tests/auto/blackbox/testdata-android/qt-app/qt-app.qbs @@ -1,7 +1,7 @@ Project { QtGuiApplication { Depends { name: "Lib" } - files: "main.cpp" + files: ["main.cpp", "MainWindow.cpp", "MainWindow.h"] Android.sdk.packageName: "my.qtapp" Android.sdk.apkBaseName: name Depends { name: "Qt"; submodules: ["core", "widgets"] } 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>() << (QByteArrayList() << qtAppExpectedFiles(generateAab) - << "res/layout/splash.xml")) + << (QList<QByteArrayList>() << (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>() << (QByteArrayList() << qmlAppExpectedFiles(generateAab) - << "res/layout/splash.xml")) + << (QList<QByteArrayList>() << 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<QByteArrayList>() << qmlAppExpectedFiles(generateAab)) + << (QList<QByteArrayList>() << qmlAppExpectedFiles(generateAab, enableAapt2)) << (QStringList() << qmlAppCustomProperties << aaptVersion(enableAapt2) << packageType(generateAab)) << enableAapt2 << generateAab << isIncrementalBuild; generateAab = true; QTest::newRow("qml app aab") << "qml-app" << QStringList("qmlapp") - << (QList<QByteArrayList>() << qmlAppExpectedFiles(generateAab)) + << (QList<QByteArrayList>() << 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>() << (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<QByteArrayList>() << qmlAppMinistroExpectedFiles(generateAab)) + << (QList<QByteArrayList>() << 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<QByteArrayList>() << 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<QByteArrayList>() << 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>() << (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>() << (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>() << (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>() << (QByteArrayList() + << qmlAppCustomMetaDataExpectedFiles(generateAab, + enableAapt2))) + << QStringList{"modules.Android.sdk.automaticSources:true", aaptVersion(enableAapt2), + packageType(generateAab)} + << enableAapt2 << generateAab << isIncrementalBuild; + } isIncrementalBuild = false; enableAapt2 = false; generateAab = false; diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp index a7037fa0f..4837d6000 100644 --- a/tests/auto/language/tst_language.cpp +++ b/tests/auto/language/tst_language.cpp @@ -1170,12 +1170,16 @@ void TestLanguage::getNativeSetting() project = loader->loadProject(defaultParameters); QString expectedTargetName; - if (HostOsInfo::isMacosHost()) - expectedTargetName = QStringLiteral("Mac OS X"); - else if (HostOsInfo::isWindowsHost()) + if (HostOsInfo::isMacosHost()) { + if (HostOsInfo::hostOsVersion() >= qbs::Version(11)) + expectedTargetName = QStringLiteral("macOS"); + else + expectedTargetName = QStringLiteral("Mac OS X"); + } else if (HostOsInfo::isWindowsHost()) { expectedTargetName = QStringLiteral("Windows"); - else + } else { expectedTargetName = QStringLiteral("Unix"); + } QVERIFY(!!project); QHash<QString, ResolvedProductPtr> products; |