diff options
-rw-r--r-- | dist/dist.qbs | 1 | ||||
-rw-r--r-- | qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs | 3 | ||||
-rw-r--r-- | src/app/config-ui/commandlineparser.h | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-qt/commandlineparser.h | 4 | ||||
-rw-r--r-- | src/app/qbs-setup-toolchains/commandlineparser.h | 4 | ||||
-rw-r--r-- | src/app/qbs/parser/parsercommand.h | 2 | ||||
-rw-r--r-- | src/app/qbs/qbs.pro | 5 | ||||
-rw-r--r-- | src/lib/corelib/api/internaljobs.cpp | 2 | ||||
-rw-r--r-- | src/lib/corelib/api/project.cpp | 4 | ||||
-rw-r--r-- | src/lib/corelib/corelib.pro | 5 | ||||
-rw-r--r-- | src/lib/corelib/language/tst_language.cpp | 39 | ||||
-rw-r--r-- | src/libexec/libexec.pri | 7 | ||||
-rw-r--r-- | tests/auto/api/api.pro | 5 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 2 | ||||
-rw-r--r-- | tests/auto/language/testdata/moduleproperties.qbs | 17 |
15 files changed, 74 insertions, 30 deletions
diff --git a/dist/dist.qbs b/dist/dist.qbs index c5c247caf..a5ba27308 100644 --- a/dist/dist.qbs +++ b/dist/dist.qbs @@ -13,6 +13,7 @@ Product { Depends { name: "qbs-setup-qt" } Depends { name: "qbs-setup-toolchains" } Depends { name: "qbs_app" } + Depends { name: "qbs_processlauncher" } Depends { name: "qbscore" } Depends { name: "qbsqtprofilesetup" } Depends { name: "qbs_cpp_scanner" } diff --git a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs index 24b655398..0e93f81b4 100644 --- a/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs +++ b/qbs-resources/modules/qbsbuildconfig/qbsbuildconfig.qbs @@ -9,7 +9,8 @@ Module { property string appInstallDir: "bin" property string libInstallDir: qbs.targetOS.contains("windows") ? "bin" : libDirName property string importLibInstallDir: libDirName - property string libexecInstallDir: "libexec/qbs" + property string libexecInstallDir: qbs.targetOS.contains("windows") ? appInstallDir + : "libexec/qbs" property bool installHtml: true property bool installQch: false property string docInstallDir: "share/doc/qbs/html" diff --git a/src/app/config-ui/commandlineparser.h b/src/app/config-ui/commandlineparser.h index 5902f4065..1146f9893 100644 --- a/src/app/config-ui/commandlineparser.h +++ b/src/app/config-ui/commandlineparser.h @@ -52,9 +52,9 @@ public: QString usageString() const; private: - void throwError(const QString &message); + Q_NORETURN void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); - void complainAboutExtraArguments(); + Q_NORETURN void complainAboutExtraArguments(); bool m_helpRequested; QString m_settingsDir; diff --git a/src/app/qbs-setup-qt/commandlineparser.h b/src/app/qbs-setup-qt/commandlineparser.h index 4329136d6..5952061f8 100644 --- a/src/app/qbs-setup-qt/commandlineparser.h +++ b/src/app/qbs-setup-qt/commandlineparser.h @@ -56,9 +56,9 @@ public: QString usageString() const; private: - void throwError(const QString &message); + Q_NORETURN void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); - void complainAboutExtraArguments(); + Q_NORETURN void complainAboutExtraArguments(); bool m_helpRequested; bool m_autoDetectionMode; diff --git a/src/app/qbs-setup-toolchains/commandlineparser.h b/src/app/qbs-setup-toolchains/commandlineparser.h index 5737d318b..c2c501bb1 100644 --- a/src/app/qbs-setup-toolchains/commandlineparser.h +++ b/src/app/qbs-setup-toolchains/commandlineparser.h @@ -57,9 +57,9 @@ public: QString usageString() const; private: - void throwError(const QString &message); + Q_NORETURN void throwError(const QString &message); void assignOptionArgument(const QString &option, QString &argument); - void complainAboutExtraArguments(); + Q_NORETURN void complainAboutExtraArguments(); bool m_helpRequested; bool m_autoDetectionMode; diff --git a/src/app/qbs/parser/parsercommand.h b/src/app/qbs/parser/parsercommand.h index e72318b7f..151626429 100644 --- a/src/app/qbs/parser/parsercommand.h +++ b/src/app/qbs/parser/parsercommand.h @@ -65,7 +65,7 @@ protected: void addAllToAdditionalArguments(QStringList &input); void addOneToAdditionalArguments(const QString &argument); QString supportedOptionsDescription() const; - void throwError(const QString &reason); + Q_NORETURN void throwError(const QString &reason); private: QList<CommandLineOption::Type> actualSupportedOptions() const; diff --git a/src/app/qbs/qbs.pro b/src/app/qbs/qbs.pro index f2c3023b6..ac9d6f0ca 100644 --- a/src/app/qbs/qbs.pro +++ b/src/app/qbs/qbs.pro @@ -20,7 +20,10 @@ HEADERS += \ qbstool.h include(../../library_dirname.pri) -isEmpty(QBS_RELATIVE_LIBEXEC_PATH):QBS_RELATIVE_LIBEXEC_PATH=../libexec/qbs +isEmpty(QBS_RELATIVE_LIBEXEC_PATH) { + win32:QBS_RELATIVE_LIBEXEC_PATH=. + else:QBS_RELATIVE_LIBEXEC_PATH=../libexec/qbs +} isEmpty(QBS_RELATIVE_PLUGINS_PATH):QBS_RELATIVE_PLUGINS_PATH=../$${QBS_LIBRARY_DIRNAME} isEmpty(QBS_RELATIVE_SEARCH_PATH):QBS_RELATIVE_SEARCH_PATH=.. DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\" diff --git a/src/lib/corelib/api/internaljobs.cpp b/src/lib/corelib/api/internaljobs.cpp index 54ce7bfe1..f6978ffc8 100644 --- a/src/lib/corelib/api/internaljobs.cpp +++ b/src/lib/corelib/api/internaljobs.cpp @@ -196,7 +196,7 @@ void InternalJobThreadWrapper::start() setTimed(m_job->timed()); m_thread.start(); m_running = true; - emit startRequested(); + QTimer::singleShot(0, this, &InternalJobThreadWrapper::startRequested); } void InternalJobThreadWrapper::handleFinished() diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp index 017db6f42..fba895e2f 100644 --- a/src/lib/corelib/api/project.cpp +++ b/src/lib/corelib/api/project.cpp @@ -153,6 +153,7 @@ BuildJob *ProjectPrivate::buildProducts(const QList<ResolvedProductPtr> &product BuildJob * const job = new BuildJob(logger, jobOwner); job->build(internalProject, productsToBuild, options); + QBS_ASSERT(job->state() == AbstractJob::StateRunning,); return job; } @@ -161,6 +162,7 @@ CleanJob *ProjectPrivate::cleanProducts(const QList<ResolvedProductPtr> &product { CleanJob * const job = new CleanJob(logger, jobOwner); job->clean(internalProject, products, options); + QBS_ASSERT(job->state() == AbstractJob::StateRunning,); return job; } @@ -172,6 +174,7 @@ InstallJob *ProjectPrivate::installProducts(const QList<ResolvedProductPtr> &pro addDependencies(productsToInstall); InstallJob * const job = new InstallJob(logger, jobOwner); job->install(internalProject, productsToInstall, options); + QBS_ASSERT(job->state() == AbstractJob::StateRunning,); return job; } @@ -916,6 +919,7 @@ SetupProjectJob *Project::setupProject(const SetupProjectParameters ¶meters, try { loadPlugins(parameters.pluginPaths(), logger); job->resolve(*this, parameters); + QBS_ASSERT(job->state() == AbstractJob::StateRunning,); } catch (const ErrorInfo &error) { // Throwing from here would complicate the API, so let's report the error the same way // as all others, via AbstractJob::error(). diff --git a/src/lib/corelib/corelib.pro b/src/lib/corelib/corelib.pro index 0ca361850..97093e319 100644 --- a/src/lib/corelib/corelib.pro +++ b/src/lib/corelib/corelib.pro @@ -1,7 +1,10 @@ TARGET = qbscore include(../library.pri) -isEmpty(QBS_RELATIVE_LIBEXEC_PATH):QBS_RELATIVE_LIBEXEC_PATH=../libexec/qbs +isEmpty(QBS_RELATIVE_LIBEXEC_PATH) { + win32:QBS_RELATIVE_LIBEXEC_PATH=../bin + else:QBS_RELATIVE_LIBEXEC_PATH=../libexec/qbs +} DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\" QT += core-private network script diff --git a/src/lib/corelib/language/tst_language.cpp b/src/lib/corelib/language/tst_language.cpp index 5485b74f0..3f94c68ec 100644 --- a/src/lib/corelib/language/tst_language.cpp +++ b/src/lib/corelib/language/tst_language.cpp @@ -1237,44 +1237,51 @@ void TestLanguage::jsImportUsedInMultipleScopes() void TestLanguage::moduleProperties_data() { QTest::addColumn<QString>("propertyName"); - QTest::addColumn<QStringList>("expectedValues"); - QTest::newRow("init") << QString() << QStringList(); + QTest::addColumn<QVariant>("expectedValue"); + QTest::newRow("init") << QString() << QVariant(); QTest::newRow("merge_lists") << "defines" - << (QStringList() << "THE_PRODUCT" << "QT_CORE" << "QT_GUI" << "QT_NETWORK"); + << QVariant(QStringList() << "THE_PRODUCT" << "QT_CORE" << "QT_GUI" << "QT_NETWORK"); QTest::newRow("merge_lists_and_values") << "defines" - << (QStringList() << "THE_PRODUCT" << "QT_CORE" << "QT_GUI" << "QT_NETWORK"); + << QVariant(QStringList() << "THE_PRODUCT" << "QT_CORE" << "QT_GUI" << "QT_NETWORK"); QTest::newRow("merge_lists_with_duplicates") << "cxxFlags" - << (QStringList() << "-foo" << "BAR" << "-foo" << "BAZ"); + << QVariant(QStringList() << "-foo" << "BAR" << "-foo" << "BAZ"); QTest::newRow("merge_lists_with_prototype_values") << "rpaths" - << (QStringList() << "/opt/qt/lib" << "$ORIGIN"); + << QVariant(QStringList() << "/opt/qt/lib" << "$ORIGIN"); QTest::newRow("list_property_that_references_product") << "listProp" - << (QStringList() << "x" << "123"); + << QVariant(QStringList() << "x" << "123"); QTest::newRow("list_property_depending_on_overridden_property") << "listProp2" - << (QStringList() << "PRODUCT_STUFF" << "DEFAULT_STUFF" << "EXTRA_STUFF"); - QTest::newRow("overridden_list_property") << "listProp" << (QStringList() << "PRODUCT_STUFF"); - QTest::newRow("cleanup") << QString() << QStringList(); + << QVariant(QStringList() << "PRODUCT_STUFF" << "DEFAULT_STUFF" << "EXTRA_STUFF"); + QTest::newRow("overridden_list_property") + << "listProp" + << QVariant(QStringList() << "PRODUCT_STUFF"); + QTest::newRow("shadowed-list-property") + << "defines" + << QVariant(QStringList() << "MyProject" << "shadowed-list-property"); + QTest::newRow("shadowed-scalar-property") + << "someString" + << QVariant(QString("MyProject_shadowed-scalar-property")); + QTest::newRow("cleanup") << QString() << QVariant(); } void TestLanguage::moduleProperties() { HANDLE_INIT_CLEANUP_DATATAGS("moduleproperties.qbs"); QFETCH(QString, propertyName); - QFETCH(QStringList, expectedValues); + QFETCH(QVariant, expectedValue); QHash<QString, ResolvedProductPtr> products = productsFromProject(project); const QString productName = QString::fromLocal8Bit(QTest::currentDataTag()); ResolvedProductPtr product = products.value(productName); QVERIFY(!!product); - QVariant values = product->moduleProperties->moduleProperty("dummy", propertyName); - QStringList valueStrings; - foreach (const QVariant &v, values.toList()) - valueStrings += v.toString(); - QCOMPARE(valueStrings, expectedValues); + const QVariant value = product->moduleProperties->moduleProperty("dummy", propertyName); + QEXPECT_FAIL("shadowed-list-property", "QBS-1117", Continue); + QEXPECT_FAIL("shadowed-scalar-property", "QBS-1117", Continue); + QCOMPARE(value, expectedValue); } void TestLanguage::modulePropertiesInGroups() diff --git a/src/libexec/libexec.pri b/src/libexec/libexec.pri index 5eeb7b9db..a5cd2c599 100644 --- a/src/libexec/libexec.pri +++ b/src/libexec/libexec.pri @@ -1,8 +1,11 @@ include(../install_prefix.pri) +win32:LIBEXEC_BASE_DIR=bin +else:LIBEXEC_BASE_DIR=libexec/qbs + !isEmpty(QBS_LIBEXEC_DESTDIR):DESTDIR=$${QBS_LIBEXEC_DESTDIR} -else:DESTDIR = ../../../libexec/qbs +else:DESTDIR=../../../$$LIBEXEC_BASE_DIR !isEmpty(QBS_LIBEXEC_INSTALL_DIR):target.path = $${QBS_LIBEXEC_INSTALL_DIR} -else:target.path = $${QBS_INSTALL_PREFIX}/libexec/qbs +else:target.path = $${QBS_INSTALL_PREFIX}/$$LIBEXEC_BASE_DIR INSTALLS += target diff --git a/tests/auto/api/api.pro b/tests/auto/api/api.pro index e78d111d9..d9c42e7bb 100644 --- a/tests/auto/api/api.pro +++ b/tests/auto/api/api.pro @@ -4,7 +4,10 @@ HEADERS = tst_api.h SOURCES = tst_api.cpp include(../../../src/library_dirname.pri) -isEmpty(QBS_RELATIVE_LIBEXEC_PATH):QBS_RELATIVE_LIBEXEC_PATH=../libexec/qbs +isEmpty(QBS_RELATIVE_LIBEXEC_PATH) { + win32:QBS_RELATIVE_LIBEXEC_PATH=. + else:QBS_RELATIVE_LIBEXEC_PATH=../libexec/qbs +} isEmpty(QBS_RELATIVE_PLUGINS_PATH):QBS_RELATIVE_PLUGINS_PATH=../$${QBS_LIBRARY_DIRNAME} isEmpty(QBS_RELATIVE_SEARCH_PATH):QBS_RELATIVE_SEARCH_PATH=.. DEFINES += QBS_RELATIVE_LIBEXEC_PATH=\\\"$${QBS_RELATIVE_LIBEXEC_PATH}\\\" diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index a3fc97327..eb1ee0c12 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -45,6 +45,7 @@ #include <QtCore/qfileinfo.h> #include <QtCore/qscopedpointer.h> #include <QtCore/qstringlist.h> +#include <QtCore/qthread.h> #include <QtCore/qtimer.h> #include <QtTest/qtest.h> @@ -307,6 +308,7 @@ void TestApi::buildGraphLocking() // Case 4: Changing the build directory again, but cancelling the job. setupJob.reset(project3.setupProject(setupParams2, m_logSink, 0)); + QThread::sleep(1); setupJob->cancel(); waitForFinished(setupJob.data()); QVERIFY(setupJob->error().hasError()); diff --git a/tests/auto/language/testdata/moduleproperties.qbs b/tests/auto/language/testdata/moduleproperties.qbs index 16fe2ea74..8ef1a9b72 100644 --- a/tests/auto/language/testdata/moduleproperties.qbs +++ b/tests/auto/language/testdata/moduleproperties.qbs @@ -1,6 +1,9 @@ import qbs 1.0 Project { + name: "MyProject" + property string projectName: name + Product { name: "merge_lists" Depends { name: "dummyqt"; submodules: ["gui", "network"] } @@ -47,4 +50,18 @@ Project { dummy.listProp: ["PRODUCT_STUFF"] } } + + Product { + name: "shadowed-list-property" + property string productName: name + Depends { name: "dummy" } + dummy.defines: [projectName, productName] + } + + Product { + name: "shadowed-scalar-property" + property string productName: name + Depends { name: "dummy" } + dummy.someString: projectName + "_" + productName + } } |