aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml7
-rw-r--r--.github/workflows/release.yml8
-rw-r--r--CMakeLists.txt2
-rw-r--r--doc/external-resources.qdoc5
-rw-r--r--doc/reference/modules/protobufnanopb-module.qdoc155
-rw-r--r--docker-compose.yml8
-rw-r--r--docker/focal/test-qt4.Dockerfile40
-rw-r--r--qbs.pro6
-rwxr-xr-xscripts/test-qt4.sh58
-rw-r--r--share/qbs/imports/qbs/Probes/IncludeProbe.qbs2
-rw-r--r--share/qbs/imports/qbs/Probes/LibraryProbe.qbs2
-rw-r--r--share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs47
-rw-r--r--share/qbs/module-providers/Qt/setup-qt.js2
-rw-r--r--share/qbs/modules/java/JavaModule.qbs8
-rw-r--r--share/qbs/modules/xcode/xcode.qbs9
-rw-r--r--tests/auto/blackbox/testdata-android/qt-app/Test.java54
-rw-r--r--tests/auto/blackbox/testdata-android/qt-app/qt-app.qbs2
-rw-r--r--tests/auto/blackbox/testdata-qt/dbus-adaptors/car.cpp5
-rw-r--r--tests/auto/blackbox/testdata-qt/dbus-adaptors/main.cpp6
-rw-r--r--tests/auto/blackbox/testdata-qt/dbus-interfaces/controller.cpp5
-rw-r--r--tests/auto/blackbox/testdata-qt/dbus-interfaces/main.cpp5
-rw-r--r--tests/auto/blackbox/testdata-qt/forced-moc/forced-moc.qbs6
-rw-r--r--tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs8
-rw-r--r--tests/auto/blackbox/testdata-qt/plugin-meta-data/plugin-meta-data.qbs7
-rw-r--r--tests/auto/blackbox/testdata-qt/plugin-support/plugin-support.qbs10
-rw-r--r--tests/auto/blackbox/testdata-qt/qrc/i.qbs6
-rw-r--r--tests/auto/blackbox/testdata-qt/quick-compiler/quick-compiler.qbs6
-rw-r--r--tests/auto/blackbox/tst_blackboxandroid.cpp19
-rw-r--r--tests/auto/blackbox/tst_blackboxqt.cpp26
29 files changed, 504 insertions, 20 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 58bc08d54..3f6b3ed6a 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/.github/workflows/release.yml b/.github/workflows/release.yml
index 8cb447447..f807e9117 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -18,9 +18,11 @@ 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
modules.qbsbuildconfig.enableUnitTests:false
modules.qbsbuildconfig.enableBundledQt:true',
script: './scripts/build-qbs-with-qbs.sh',
@@ -67,9 +69,11 @@ jobs:
timeout-minutes: 60
env:
BUILD_OPTIONS: |
+ qbs.installPrefix:""
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 +158,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
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)
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
@@ -121,6 +121,11 @@
*/
/*!
+ \externalpage https://github.com/nanopb/nanopb
+ \title nanopb
+*/
+
+/*!
\externalpage nolink
\title macOS
\internal
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 <foo.pb.h>
+
+ 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
+*/
diff --git a/docker-compose.yml b/docker-compose.yml
index 9d59800f0..f03de93a2 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/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
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/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;
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/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];
diff --git a/share/qbs/modules/java/JavaModule.qbs b/share/qbs/modules/java/JavaModule.qbs
index c3efb15bf..ceb29f36f 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 (a.fileTags instanceof Array)
- 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/share/qbs/modules/xcode/xcode.qbs b/share/qbs/modules/xcode/xcode.qbs
index 72120ed37..6c0584c81 100644
--- a/share/qbs/modules/xcode/xcode.qbs
+++ b/share/qbs/modules/xcode/xcode.qbs
@@ -11,6 +11,11 @@ import qbs.Utilities
Module {
id: xcodeModule
+ Probes.XcodeLocationProbe {
+ id: xcodeLocationProbe
+ condition: !xcodeModule.developerPath
+ }
+
Probes.XcodeProbe {
id: xcodeProbe
developerPath: xcodeModule.developerPath
@@ -26,7 +31,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)
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/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 <QtWidgets/QtWidgets>
+#else
+#include <QtGui>
+#endif
#include <math.h>
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 <QtWidgets/QApplication>
#include <QtWidgets/QGraphicsView>
#include <QtWidgets/QGraphicsScene>
+#else
+#include <QApplication>
+#include <QGraphicsView>
+#include <QGraphicsScene>
+#endif
#include <QtDBus/QDBusConnection>
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 <QtGlobal>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QtWidgets>
+#else
+#include <QtGui>
+#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 <QtGlobal>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
#include <QtDBus>
#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_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<QByteArrayList>, 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<QString>("projectDir");
QTest::addColumn<QStringList>("productNames");
QTest::addColumn<QList<QByteArrayList>>("expectedFilesLists");
- QTest::addColumn<QStringList>("qmlAppCustomProperties");
+ QTest::addColumn<QStringList>("customProperties");
QTest::addColumn<bool>("enableAapt2");
QTest::addColumn<bool>("generateAab");
QTest::addColumn<bool>("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>() << (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, {
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 <moc_myobject.cpp", "// #include <moc_myobject.cpp");
@@ -296,6 +302,8 @@ void TestBlackboxQt::pluginMetaData()
{
QDir::setCurrent(testDataDir + "/plugin-meta-data");
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");
@@ -325,7 +333,11 @@ void TestBlackboxQt::pluginSupport()
resolveParams.arguments << "modules.m1.useDummy:true";
resolveParams.expectFailure = true;
}
- QCOMPARE(runQbs(resolveParams) == 0, !invalidPlugin);
+ bool resolveResult = runQbs(resolveParams) == 0;
+ if (m_qbsStdout.contains("using qt4"))
+ QSKIP("Qt version too old");
+ QCOMPARE(resolveResult, !invalidPlugin);
+
if (invalidPlugin) {
QVERIFY2(m_qbsStderr.contains("Plugin 'dummy' of type 'imageformats' was requested, "
"but is not available"), m_qbsStderr.constData());
@@ -404,7 +416,9 @@ void TestBlackboxQt::qmlTypeRegistrar()
rmDirR(relativeBuildDir());
const QStringList args{"modules.Qt.qml.importName:" + importName,
"modules.Qt.qml.typesInstallDir:" + installDir};
- QCOMPARE(runQbs(QbsRunParameters("resolve", args)), 0);
+ if ((runQbs(QbsRunParameters("resolve", args)) != 0) &&
+ m_qbsStderr.contains("Dependency 'Qt.qml' not found for product 'myapp'"))
+ QSKIP("Qt version too old");
const bool hasRegistrar = m_qbsStdout.contains("has registrar");
const bool doesNotHaveRegistrar = m_qbsStdout.contains("does not have registrar");
QVERIFY(hasRegistrar != doesNotHaveRegistrar);
@@ -437,7 +451,9 @@ void TestBlackboxQt::qtKeywords()
void TestBlackboxQt::quickCompiler()
{
QDir::setCurrent(testDataDir + "/quick-compiler");
- QCOMPARE(runQbs(), 0);
+ if ((runQbs() != 0) &&
+ m_qbsStderr.contains("'Qt.quick' has version 4.8.7, but it needs to be at least 5.0.0."))
+ QSKIP("Qt version too old");
const bool hasCompiler = m_qbsStdout.contains("compiler available");
const bool doesNotHaveCompiler = m_qbsStdout.contains("compiler not available");
QVERIFY2(hasCompiler || doesNotHaveCompiler, m_qbsStdout.constData());
@@ -546,6 +562,8 @@ void TestBlackboxQt::track_qrc()
{
QDir::setCurrent(testDataDir + "/qrc");
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);