From 1bb4c3c95e548bd57f733f2936e370cd40e81765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Cotty?= Date: Wed, 16 Dec 2020 15:18:07 +0100 Subject: Add qt4 docker image for basic testing Change-Id: Ied6d9eac49fcb20de72499ab7c39e83a90a98b75 Reviewed-by: Ivan Komissarov --- .github/workflows/main.yml | 7 +++ docker-compose.yml | 8 +++ docker/focal/test-qt4.Dockerfile | 40 +++++++++++++++ scripts/test-qt4.sh | 58 ++++++++++++++++++++++ .../blackbox/testdata-qt/dbus-adaptors/car.cpp | 5 ++ .../blackbox/testdata-qt/dbus-adaptors/main.cpp | 6 +++ .../testdata-qt/dbus-interfaces/controller.cpp | 5 ++ .../blackbox/testdata-qt/dbus-interfaces/main.cpp | 5 ++ .../blackbox/testdata-qt/forced-moc/forced-moc.qbs | 6 +++ .../included-moc-cpp/included-moc-cpp.qbs | 8 +++ .../plugin-meta-data/plugin-meta-data.qbs | 7 +++ .../testdata-qt/plugin-support/plugin-support.qbs | 10 ++++ tests/auto/blackbox/testdata-qt/qrc/i.qbs | 6 +++ .../testdata-qt/quick-compiler/quick-compiler.qbs | 6 ++- tests/auto/blackbox/tst_blackboxqt.cpp | 26 ++++++++-- 15 files changed, 198 insertions(+), 5 deletions(-) create mode 100644 docker/focal/test-qt4.Dockerfile create mode 100755 scripts/test-qt4.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c155ad26e..a2714380f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -257,6 +257,13 @@ jobs: profile: '', script: './scripts/test-qt-for-android.sh', } + - { + name: 'Run Linux tests (Qt 4.8.7)', + image: 'focal-qt4', + profile: '', + script: './scripts/test-qt4.sh', + } + env: QBS_TEST_SOURCE_ROOT: 'tests' QBS_AUTOTEST_PROFILE: ${{ matrix.config.profile }} diff --git a/docker-compose.yml b/docker-compose.yml index ef53a0fb0..4a2851e8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,6 +77,14 @@ services: dockerfile: docker/focal/test-baremetal.Dockerfile context: . + focal-qt4: + << : *linux + hostname: focal-qt4 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:focal-qt4-0 + build: + dockerfile: docker/focal/test-qt4.Dockerfile + context: . + windows: image: ${DOCKER_USER:-qbsbuild}/qbsdev:windowsservercore-5.15.0_1.16.0-0 build: diff --git a/docker/focal/test-qt4.Dockerfile b/docker/focal/test-qt4.Dockerfile new file mode 100644 index 000000000..c23a664d2 --- /dev/null +++ b/docker/focal/test-qt4.Dockerfile @@ -0,0 +1,40 @@ +# +# Testing Qbs with qt4 +# +FROM ubuntu:focal +LABEL Description="Ubuntu qt4 test environment for Qbs" + +# 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 \ + software-properties-common \ + sudo && \ + groupadd -g ${USER_UID} ${USER_NAME} && \ + useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ + usermod -a -G sudo ${USER_NAME} && \ + echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers + +COPY docker/focal/entrypoint.sh /sbin/entrypoint.sh +ENTRYPOINT ["/sbin/entrypoint.sh"] + +# Install baremetal toolchains and Qbs runtime dependencies. +RUN sudo add-apt-repository ppa:gezakovacs/ppa -y && \ + apt-get update -qq && \ + apt-get install -qq -y \ + build-essential \ + libqt4-dev + diff --git a/scripts/test-qt4.sh b/scripts/test-qt4.sh new file mode 100755 index 000000000..b4b0078e4 --- /dev/null +++ b/scripts/test-qt4.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +set -eu + +############################################################################# +## +## Copyright (C) 2020 Raphael Cotty. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qbs. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +export PATH="$1:$PATH" + +export LSAN_OPTIONS="suppressions=$( cd "$(dirname "$0")" ; pwd -P )/address-sanitizer-suppressions.txt:print_suppressions=0" + +# Creating the qt4 profile + +qbs-setup-toolchains /usr/bin/g++ gcc +qbs-setup-qt /usr/lib/x86_64-linux-gnu/qt4/bin/qmake qt4 +# To avoid warnings due to qt4 include files +qbs config profiles.gcc.cpp.cxxFlags "-Wno-deprecated-copy" +qbs config profiles.qt4.baseProfile gcc +qbs config --list + +export QBS_AUTOTEST_PROFILE=qt4 + +tst_blackbox-qt diff --git a/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.cpp b/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.cpp index 5e4f348d2..f67e4c193 100644 --- a/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.cpp +++ b/tests/auto/blackbox/testdata-qt/dbus-adaptors/car.cpp @@ -49,7 +49,12 @@ ****************************************************************************/ #include "car.h" + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include +#else +#include +#endif #include static const double Pi = 3.14159265358979323846264338327950288419717; diff --git a/tests/auto/blackbox/testdata-qt/dbus-adaptors/main.cpp b/tests/auto/blackbox/testdata-qt/dbus-adaptors/main.cpp index 0491719d7..197005215 100644 --- a/tests/auto/blackbox/testdata-qt/dbus-adaptors/main.cpp +++ b/tests/auto/blackbox/testdata-qt/dbus-adaptors/main.cpp @@ -50,9 +50,15 @@ #include "car.h" #include "car_adaptor.h" +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include #include #include +#else +#include +#include +#include +#endif #include int main(int argc, char *argv[]) diff --git a/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.cpp b/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.cpp index eaff5c775..f6680676a 100644 --- a/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.cpp +++ b/tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.cpp @@ -48,7 +48,12 @@ ** ****************************************************************************/ +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include +#else +#include +#endif #include "controller.h" #include "car_interface.h" diff --git a/tests/auto/blackbox/testdata-qt/dbus-interfaces/main.cpp b/tests/auto/blackbox/testdata-qt/dbus-interfaces/main.cpp index fdd9fc590..5ceba5a9f 100644 --- a/tests/auto/blackbox/testdata-qt/dbus-interfaces/main.cpp +++ b/tests/auto/blackbox/testdata-qt/dbus-interfaces/main.cpp @@ -48,7 +48,12 @@ ** ****************************************************************************/ +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include +#else +#include +#endif #include #include "controller.h" diff --git a/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs b/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs index 736f40347..aab7ed220 100644 --- a/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs +++ b/tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs @@ -1,5 +1,11 @@ +import qbs.Utilities + QtApplication { condition: { + if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { + console.info("using qt4"); + return false; + } var result = qbs.targetPlatform === qbs.hostPlatform; if (!result) console.info("targetPlatform differs from hostPlatform"); diff --git a/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs b/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs index 1ed85ccdd..218d5c150 100644 --- a/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs +++ b/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs @@ -1,6 +1,14 @@ import qbs +import qbs.Utilities QtApplication { + condition: { + if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { + console.info("using qt4"); + return false; + } + return true; + } files: [ "main.cpp", "myobject.cpp", diff --git a/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs b/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs index 7fb477575..7e5f98340 100644 --- a/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs +++ b/tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs @@ -1,6 +1,13 @@ +import qbs.Utilities + Project { QtApplication { condition: { + if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { + // qt4 moc can't be used with pluginMetaData + console.info("using qt4"); + return false; + } var result = qbs.targetPlatform === qbs.hostPlatform; if (!result) console.info("targetPlatform differs from hostPlatform"); diff --git a/tests/auto/blackbox/testdata-qt/plugin-support/plugin-support.qbs b/tests/auto/blackbox/testdata-qt/plugin-support/plugin-support.qbs index c554a7dc2..8e0923e94 100644 --- a/tests/auto/blackbox/testdata-qt/plugin-support/plugin-support.qbs +++ b/tests/auto/blackbox/testdata-qt/plugin-support/plugin-support.qbs @@ -1,4 +1,14 @@ +import qbs.Utilities + QtGuiApplication { + condition: { + // pluginTypes empty for Qt4 + if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { + console.info("using qt4"); + return false; + } + return true; + } Probe { id: staticProbe property bool isStaticQt: Qt.gui.isStaticLibrary diff --git a/tests/auto/blackbox/testdata-qt/qrc/i.qbs b/tests/auto/blackbox/testdata-qt/qrc/i.qbs index 604652a8e..e98c069b5 100644 --- a/tests/auto/blackbox/testdata-qt/qrc/i.qbs +++ b/tests/auto/blackbox/testdata-qt/qrc/i.qbs @@ -1,6 +1,12 @@ +import qbs.Utilities + Project { Product { condition: { + if (Utilities.versionCompare(Qt.core.version, "5.0") < 0) { + console.info("using qt4"); + return false; + } var result = qbs.targetPlatform === qbs.hostPlatform; if (!result) console.info("targetPlatform differs from hostPlatform"); diff --git a/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs b/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs index b141c8672..793d261e9 100644 --- a/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs +++ b/tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs @@ -1,5 +1,9 @@ CppApplication { - Depends { name: "Qt.quick" } + Depends { + name: "Qt.quick" + // Must fail when using Qt4 + versionAtLeast: "5" + } Qt.quick.useCompiler: Qt.quick.compilerAvailable cpp.cxxLanguageVersion: "c++11" diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 4fc038923..53fadc490 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -70,7 +70,9 @@ void TestBlackboxQt::autoQrc() void TestBlackboxQt::cachedQml() { QDir::setCurrent(testDataDir + "/cached-qml"); - QCOMPARE(runQbs(), 0); + if ((runQbs() != 0) && m_qbsStderr.contains("Dependency 'Qt.qml' not found for product 'app'")) + QSKIP("Qt version too old"); + QString dataDir = relativeBuildDir() + "/install-root/data"; QVERIFY2(m_qbsStdout.contains("qmlcachegen must work: true") || m_qbsStdout.contains("qmlcachegen must work: false"), @@ -133,6 +135,8 @@ void TestBlackboxQt::forcedMoc() { QDir::setCurrent(testDataDir + "/forced-moc"); QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); + if (m_qbsStdout.contains("using qt4")) + QSKIP("Qt version too old"); if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) QSKIP("Cannot run binaries in cross-compiled build"); QCOMPARE(runQbs(QbsRunParameters("run")), 0); @@ -143,6 +147,8 @@ void TestBlackboxQt::includedMocCpp() { QDir::setCurrent(testDataDir + "/included-moc-cpp"); QCOMPARE(runQbs(), 0); + if (m_qbsStdout.contains("using qt4")) + QSKIP("Qt version too old"); QVERIFY2(!m_qbsStdout.contains("compiling moc_myobject.cpp"), m_qbsStdout.constData()); WAIT_FOR_NEW_TIMESTAMP(); REPLACE_IN_FILE("myobject.cpp", "#include Date: Thu, 17 Dec 2020 13:03:33 +0100 Subject: Add protobuf.nanopb documentation Change-Id: Id0e2744fc9dcf8b30bf15eb543036947399664e3 Reviewed-by: Ivan Komissarov Reviewed-by: Christian Kandeler --- doc/external-resources.qdoc | 5 + doc/reference/modules/protobufnanopb-module.qdoc | 155 +++++++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 doc/reference/modules/protobufnanopb-module.qdoc diff --git a/doc/external-resources.qdoc b/doc/external-resources.qdoc index 00b7bf975..b3e0f1c2b 100644 --- a/doc/external-resources.qdoc +++ b/doc/external-resources.qdoc @@ -120,6 +120,11 @@ \title protoc */ +/*! + \externalpage https://github.com/nanopb/nanopb + \title nanopb +*/ + /*! \externalpage nolink \title macOS diff --git a/doc/reference/modules/protobufnanopb-module.qdoc b/doc/reference/modules/protobufnanopb-module.qdoc new file mode 100644 index 000000000..75c87ba57 --- /dev/null +++ b/doc/reference/modules/protobufnanopb-module.qdoc @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmltype protobuf.nanopb + \inqmlmodule QbsModules + \since Qbs 1.18 + + \brief Provides support for protocol buffers for embedded systems. + + The \c protobuf.nanopb module provides support for generating nanopb C headers + and sources from proto definition files using the \l nanopb plugin for the + \l protoc tool suitable for embedded systems. + + A simple qbs file that uses protobuf can be written as follows: + \code + CppApplication { + Depends { name: "protobuf.nanopb" } + files: ["foo.proto", "main.cpp"] + } + \endcode + A generated header now can be included in the C++ sources: + \code + #include + + int main(int argc, char* argv[]) { + Foo bar; + bar.has_answer = true; + bar.answer = 42; + return 0; + } + \endcode + + Nanopb .options files to define nanopb specific proto options are supported. + + \section2 Relevant File Tags + + \table + \header + \li Tag + \li Auto-tagged File Names + \li Since + \li Description + \row + \li \c{"protobuf.input"} + \li \c{*.proto} + \li 1.13.0 + \li Source files with this tag are considered inputs to the \c protoc compiler. + \row + \li \c{"protobuf.hpp"} + \li + \li 1.18.0 + \li This tag is attached to the header files generated by \c protoc compiler. + \endtable +*/ + +/*! + \qmlproperty string protobuf.nanopb::compilerName + + The name of the protoc binary. + + \defaultvalue \c "protoc" +*/ + +/*! + \qmlproperty string protobuf.nanopb::compilerPath + + The path to the protoc binary. + + Use this property to override the auto-detected location. + + \defaultvalue \c auto-detected +*/ + +/*! + \qmlproperty pathList protobuf.nanopb::importPaths + + The list of imports that are passed to the \c protoc tool via the \c --proto_path option. + These imports should contain the proto files. They are used to determine + the relative structure of the generated files. + \note The paths are passed to \c protoc in the same order as specified in this property and + \c protoc output may differ depending on that order. + + \defaultvalue \c [] +*/ + +/*! + \qmlproperty string protobuf.nanopb::includePath + + The path where protobuf nanopb C headers are located. Set this property to override the + default location. + + \defaultvalue \c auto-detected +*/ + +/*! + \qmlproperty string protobuf.nanopb::libraryPath + + The path where the protobuf nanopb runtime library is located. Set this property to override the + default location. + + \defaultvalue \c auto-detected +*/ + +/*! + \qmlproperty string protobuf.nanopb::outputDir + \readonly + + The directory where the \c protoc compiler generated files are placed. + + The value of this property is automatically set by \QBS and cannot be + changed by the user. +*/ + +/*! + \qmlproperty string protobuf.nanopb::pluginName + + The name of the nanopb protoc plugin. + + \defaultvalue \c "protoc-gen-nanopb" +*/ + +/*! + \qmlproperty string protobuf.nanopb::pluginPath + + The path to the nanopb protoc plugin. + + Use this property to override the auto-detected location. + + \defaultvalue \c auto-detected +*/ -- cgit v1.2.3 From 2ade8330d1c9d9ce89c526693dd706ca406b56bb Mon Sep 17 00:00:00 2001 From: Jan Blackquill Date: Sun, 20 Dec 2020 23:27:14 -0500 Subject: Add more paths to search in Library and Include probes These paths are used by containerisation systems such as Flatpak; searching in these by default makes building Qbs applications in Flatpak et. al easier Change-Id: I438ba1ffd66845ac1331791428135eb70105ff34 Reviewed-by: Ivan Komissarov --- share/qbs/imports/qbs/Probes/IncludeProbe.qbs | 2 ++ share/qbs/imports/qbs/Probes/LibraryProbe.qbs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/share/qbs/imports/qbs/Probes/IncludeProbe.qbs b/share/qbs/imports/qbs/Probes/IncludeProbe.qbs index 3c1059e64..6201cbc55 100644 --- a/share/qbs/imports/qbs/Probes/IncludeProbe.qbs +++ b/share/qbs/imports/qbs/Probes/IncludeProbe.qbs @@ -32,6 +32,8 @@ PathProbe { platformSearchPaths: qbs.targetOS.contains("unix") ? [ "/usr/include", "/usr/local/include", + "/include", + "/app/include", ] : [] platformEnvironmentPaths: { if (qbs.toolchain.contains('msvc')) diff --git a/share/qbs/imports/qbs/Probes/LibraryProbe.qbs b/share/qbs/imports/qbs/Probes/LibraryProbe.qbs index 0f4220730..7631eb441 100644 --- a/share/qbs/imports/qbs/Probes/LibraryProbe.qbs +++ b/share/qbs/imports/qbs/Probes/LibraryProbe.qbs @@ -60,7 +60,7 @@ PathProbe { else if (qbs.architecture === "x86") result = ["/usr/lib32", "/usr/lib/i386-linux-gnu"] } - result = result.concat(["/usr/lib", "/usr/local/lib"]); + result = result.concat(["/usr/lib", "/usr/local/lib", "/lib", "/app/lib"]); } return result; -- cgit v1.2.3 From 297ab225ed2ce32a8b64fb7b693fe73cb82e8dc7 Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Wed, 23 Dec 2020 03:55:00 +0100 Subject: Bump version to 1.18.1 Change-Id: I151d9c3f1e42e42d72c031b523e3ab4c11c10ab1 Reviewed-by: Ivan Komissarov --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 84cc52946..ec6d649be 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.0 +1.18.1 -- cgit v1.2.3 From 8621465db2c7fa10eb014ef14d55ec7dd3e085a0 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Wed, 16 Dec 2020 10:05:05 +0100 Subject: Xcode: Fix XCode auto-detection If Xcode is moved to another location, we should use xcode-select -- print-path to find it rather than using hardcoded path. Change-Id: I9b5eba19c9e732e5e9da0322320fb0406249e020 Reviewed-by: Christian Kandeler --- .../qbs/imports/qbs/Probes/XcodeLocationProbe.qbs | 47 ++++++++++++++++++++++ share/qbs/modules/xcode/xcode.qbs | 9 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs diff --git a/share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs b/share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs new file mode 100644 index 000000000..3401315f7 --- /dev/null +++ b/share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com) +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** 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 http://www.qt.io/terms-conditions. For further information +** use the contact form at http://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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +import qbs.Process + +Probe { + property path developerPath + configure: { + var p = new Process(); + try { + p.exec("/usr/bin/xcode-select", ["--print-path"], true); + developerPath = p.readStdOut().trim(); + } catch (e) { + developerPath = "/Applications/Xcode.app/Contents/Developer"; + } finally { + p.close(); + found = true; + } + } +} diff --git a/share/qbs/modules/xcode/xcode.qbs b/share/qbs/modules/xcode/xcode.qbs index e4df1f20b..aeb0760ac 100644 --- a/share/qbs/modules/xcode/xcode.qbs +++ b/share/qbs/modules/xcode/xcode.qbs @@ -12,6 +12,11 @@ import 'xcode.js' as Xcode Module { id: xcodeModule + Probes.XcodeLocationProbe { + id: xcodeLocationProbe + condition: !xcodeModule.developerPath + } + Probes.XcodeProbe { id: xcodeProbe developerPath: xcodeModule.developerPath @@ -27,7 +32,9 @@ Module { version: xcodeProbe.xcodeVersion - property path developerPath: "/Applications/Xcode.app/Contents/Developer" + property path developerPath: xcodeLocationProbe.found + ? xcodeLocationProbe.developerPath + : undefined property string sdk: DarwinTools.applePlatformName(qbs.targetOS, platformType) property stringList targetDevices: DarwinTools.targetDevices(qbs.targetOS) -- cgit v1.2.3 From 01a8b6e11986a3260e911e6a95a0d85d17467c49 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 13 Jan 2021 08:31:41 +0100 Subject: cmake build: Turn project file updates on by default Project file updates should be supported by any qbs binary, since nowadays IDE integration is not tied to a special build of Qbs. Task-number: QTCREATORBUG-25232 Change-Id: Ic2fe6b0ecdb77d84209ce16fdfe8158334a8bb29 Reviewed-by: Christian Kandeler Reviewed-by: Ivan Komissarov --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d23ddf8cc..f6a87d10d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ set(CMAKE_AUTOUIC ON) option(WITH_TESTS "Build Tests" ON) option(WITH_UNIT_TESTS "Build Unit Tests" OFF) -option(WITH_PROJECT_FILE_UPDATES "Enable project file updates support" OFF) +option(WITH_PROJECT_FILE_UPDATES "Enable project file updates support" ON) option(INSTALL_PUBLIC_HEADERS "Whether to install public headers" ON) option(QBS_INSTALL_HTML_DOCS "Whether to install HTML Documentation" OFF) option(QBS_INSTALL_QCH_DOCS "Whether to install QCH Documentation" OFF) -- cgit v1.2.3 From ca486ad0b138d75a6ef73bfc2517424406155d7c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 22 Jan 2021 15:42:55 +0100 Subject: Qt/Android: Extend rule cycle prevention hack After we did remove the hpp tag from the java-generated header, it was re-added by a file tagger in the cpp modules file, leading to an unexpected state on rebuilding. Fix this by replacing the tag, rather than removing it. Fixes: QBS-1628 Change-Id: I9d182cd30cf9a637733b84234e7a0b37f7583334 Reviewed-by: Ivan Komissarov --- share/qbs/modules/java/JavaModule.qbs | 8 +++- .../blackbox/testdata-android/qt-app/Test.java | 54 ++++++++++++++++++++++ .../blackbox/testdata-android/qt-app/qt-app.qbs | 2 +- tests/auto/blackbox/tst_blackboxandroid.cpp | 19 ++++++-- 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 tests/auto/blackbox/testdata-android/qt-app/Test.java diff --git a/share/qbs/modules/java/JavaModule.qbs b/share/qbs/modules/java/JavaModule.qbs index 71f7d8432..ad055fe34 100644 --- a/share/qbs/modules/java/JavaModule.qbs +++ b/share/qbs/modules/java/JavaModule.qbs @@ -234,14 +234,18 @@ Module { inputsFromDependencies: ["java.jar"] explicitlyDependsOn: ["java.class-internal"] - outputFileTags: ["java.class"].concat(_tagJniHeaders ? ["hpp"] : []) // Annotations can produce additional java source files. Ignored for now. + outputFileTags: ["java.class"].concat(_tagJniHeaders ? ["hpp"] : ["java.jni-hpp"]) // Annotations can produce additional java source files. Ignored for now. outputArtifacts: { var artifacts = JavaUtils.outputArtifacts(product, inputs); if (!product.java._tagJniHeaders) { for (var i = 0; i < artifacts.length; ++i) { var a = artifacts[i]; if (Array.isArray(a.fileTags)) - a.fileTags = a.fileTags.filter(function(tag) { return tag != "hpp"; }); + a.fileTags = a.fileTags.map(function(tag) { + if (tag === "hpp") + return "java.jni-hpp"; + return tag; + }); } } return artifacts; diff --git a/tests/auto/blackbox/testdata-android/qt-app/Test.java b/tests/auto/blackbox/testdata-android/qt-app/Test.java new file mode 100644 index 000000000..c57486d56 --- /dev/null +++ b/tests/auto/blackbox/testdata-android/qt-app/Test.java @@ -0,0 +1,54 @@ +package org.qbs.example; + +import org.qtproject.qt5.android.bindings.QtActivity; +import android.os.*; +import android.content.*; +import android.app.*; +import android.util.Log; + +import java.lang.String; +import android.content.Intent; + +import org.qbs.example.*; + + +public class Test extends QtActivity +{ + public static native void testFunc(String test); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Log.d("qbs", "onCreate Test"); + Intent theIntent = getIntent(); + if (theIntent != null) { + String theAction = theIntent.getAction(); + if (theAction != null) { + Log.d("qbs onCreate ", theAction); + } + } + } + + @Override + public void onDestroy() { + Log.d("qbs", "onDestroy"); + System.exit(0); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + Log.d("qbs onActivityResult", "requestCode: "+requestCode); + if (resultCode == RESULT_OK) { + Log.d("qbs onActivityResult - resultCode: ", "SUCCESS"); + } else { + Log.d("qbs onActivityResult - resultCode: ", "CANCEL"); + } + } + + @Override + public void onNewIntent(Intent intent) { + Log.d("qbs", "onNewIntent"); + super.onNewIntent(intent); + setIntent(intent); + } +} 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 981c9eb3d..94093af64 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", "MainWindow.cpp", "MainWindow.h"] + files: ["main.cpp", "MainWindow.cpp", "MainWindow.h", "Test.java"] 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 291960792..a03c9e318 100644 --- a/tests/auto/blackbox/tst_blackboxandroid.cpp +++ b/tests/auto/blackbox/tst_blackboxandroid.cpp @@ -79,7 +79,7 @@ void TestBlackboxAndroid::android() QFETCH(QString, projectDir); QFETCH(QStringList, productNames); QFETCH(QList, expectedFilesLists); - QFETCH(QStringList, qmlAppCustomProperties); + QFETCH(QStringList, customProperties); QFETCH(bool, enableAapt2); QFETCH(bool, generateAab); QFETCH(bool, isIncrementalBuild); @@ -112,6 +112,8 @@ void TestBlackboxAndroid::android() const QString buildSubDir = enableAapt2 ? (generateAab ? "aab" : "aapt2") : "aapt"; QDir::setCurrent(testDataDir + "/" + projectDir); + if (!isIncrementalBuild) + rmDirR(relativeBuildDir(buildSubDir)); static const QStringList configNames { "debug", "release" }; for (const QString &configName : configNames) { @@ -119,7 +121,7 @@ void TestBlackboxAndroid::android() const QString configArgument = "config:" + configName; QbsRunParameters resolveParams("resolve"); resolveParams.buildDirectory = buildSubDir; - resolveParams.arguments << configArgument << qmlAppCustomProperties; + resolveParams.arguments << configArgument << customProperties; resolveParams.profile = p.name(); QCOMPARE(runQbs(resolveParams), 0); QbsRunParameters buildParams(QStringList{"--command-echo-mode", "command-line", @@ -279,7 +281,7 @@ void TestBlackboxAndroid::android_data() QTest::addColumn("projectDir"); QTest::addColumn("productNames"); QTest::addColumn>("expectedFilesLists"); - QTest::addColumn("qmlAppCustomProperties"); + QTest::addColumn("customProperties"); QTest::addColumn("enableAapt2"); QTest::addColumn("generateAab"); QTest::addColumn("isIncrementalBuild"); @@ -351,6 +353,17 @@ void TestBlackboxAndroid::android_data() << QStringList{aaptVersion(enableAapt2), packageType(generateAab)} << enableAapt2 << generateAab << isIncrementalBuild; + const QByteArrayList ndkArchsForQtSave = ndkArchsForQt; + ndkArchsForQt = {ndkArchsForQt.first()}; + QTest::newRow("qt app (single arch)") + << "qt-app" << QStringList("qt-app") + << (QList() << (QByteArrayList() << qtAppExpectedFiles(generateAab, + enableAapt2))) + << QStringList{aaptVersion(enableAapt2), packageType(generateAab), + "modules.qbs.architectures:" + archsForQt.first()} + << enableAapt2 << generateAab << isIncrementalBuild; + ndkArchsForQt = ndkArchsForQtSave; + auto teaPotAppExpectedFiles = [&](const QByteArrayList &archs, bool generateAab) { QByteArrayList expectedFile; expectedFile << commonFiles(generateAab) + expandArchs(archs, { -- cgit v1.2.3 From 66067b05faa48efe7e5c6eb81e12766b997ca65d Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Thu, 28 Jan 2021 22:17:19 +0100 Subject: Fix static build with qmake Building Qbs statically did not work since Qbs 1.17 because the application target did not correctly track the plugins as a dependency. The condition in qbs.pro was simply wrong. Fixes: QBS-1594 Change-Id: Id906423bd0d8d85b7a4f3342df4b9d39f60c4e36 Reviewed-by: Christian Kandeler --- qbs.pro | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qbs.pro b/qbs.pro index 565a6a632..0ec8d07b9 100644 --- a/qbs.pro +++ b/qbs.pro @@ -35,12 +35,10 @@ msbuildlib.subdir = src/lib/msbuild msbuildlib.depends = corelib src_app.subdir = src/app src_app.depends = corelib +CONFIG(static, static|shared): src_app.depends += src_plugins src_libexec.subdir = src/libexec src_plugins.subdir = src/plugins -CONFIG(shared, static|shared) { - src_plugins.depends = corelib - src_app.depends += src_plugins -} +CONFIG(shared, static|shared): src_plugins.depends = corelib src_plugins.depends += msbuildlib tests.depends = static_res static_res.file = static-res.pro -- cgit v1.2.3 From 288457440779a12e788315087a96036f905030af Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Fri, 12 Feb 2021 00:53:59 +0100 Subject: qt6: fix handling qtmain in setup-qt.js Change-Id: I00fa1d5e3a2fdb24a84afe713c3ea2c4543f84bd Reviewed-by: Christian Kandeler --- share/qbs/module-providers/Qt/setup-qt.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index a67f79d89..70acc753c 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -197,6 +197,8 @@ function fillEntryPointLibs(qtProps, debug) { var qtMainCandidates = ["qtmain"]; if (isMinGW && qtProps.qtMajorVersion === 5) qtMainCandidates.push("qt5main"); + if (qtProps.qtMajorVersion === 6) + qtMainCandidates.push("Qt6EntryPoint"); for (var i = 0; i < qtMainCandidates.length; ++i) { var baseNameCandidate = qtMainCandidates[i]; -- cgit v1.2.3 From 81ee001859f991dc61a53e3ba5e938724bf5b47e Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 14 Feb 2021 15:30:44 +0100 Subject: do not depend on QtGui in release builds Change-Id: I3be7b45e105fe2f605b4ffaf7ed059c62d790edb Reviewed-by: Christian Kandeler --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ede39d7c..22ae206a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,7 @@ jobs: options: 'modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableAddressSanitizer:false + modules.qbsbuildconfig.enableProjectFileUpdates:false modules.qbsbuildconfig.enableUnitTests:false modules.qbsbuildconfig.enableBundledQt:true', script: './scripts/build-qbs-with-qbs.sh', @@ -70,6 +71,7 @@ jobs: modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableUnitTests:false + modules.qbsbuildconfig.enableProjectFileUpdates:false modules.qbsbuildconfig.enableAddressSanitizer:false modules.qbsbuildconfig.enableBundledQt:true WITH_TESTS: 0 @@ -154,7 +156,7 @@ jobs: qbs.buildVariant:release modules.cpp.compilerWrapper:clcache modules.qbsbuildconfig.enableBundledQt:true - modules.qbsbuildconfig.enableProjectFileUpdates:true + modules.qbsbuildconfig.enableProjectFileUpdates:false modules.qbsbuildconfig.enableUnitTests:false modules.cpp.treatWarningsAsErrors:true project.withDocumentation:true -- cgit v1.2.3 From 7b50dca83a5a75a5c24b5ef329f25990daf2ff50 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Tue, 16 Feb 2021 17:19:29 +0100 Subject: GitHub actions: use empty qbs.installPrefix for release packages Change-Id: Ifddbebe4b3126d9f705df860622abd44bf5e5b7b Reviewed-by: Richard Weickelt Reviewed-by: Christian Kandeler --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22ae206a6..5fe4c33de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,8 @@ jobs: config: - { name: 'Build on Linux (gcc)', - options: 'modules.cpp.compilerWrapper:ccache + options: 'qbs.installPrefix:"" + modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableAddressSanitizer:false modules.qbsbuildconfig.enableProjectFileUpdates:false @@ -68,6 +69,7 @@ jobs: timeout-minutes: 45 env: BUILD_OPTIONS: | + qbs.installPrefix:"" modules.cpp.compilerWrapper:ccache modules.qbs.debugInformation:true modules.qbsbuildconfig.enableUnitTests:false -- cgit v1.2.3