diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-06-29 12:15:42 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-04 10:48:14 +0000 |
commit | ff47f16163125b22caa3750a0c2ea26bc0f6728b (patch) | |
tree | cf29d206948570047b38cac39c5d77498d8100b6 | |
parent | fed37117f456600bb29d0cd3df6f1ababdda6404 (diff) |
ModuleLoader: Fix misleading error message
If a product could not get properly loaded and a per-product property
override was given on the command line, we used to erroneously complain
about the property override instead of reporting the real error.
Change-Id: I1cbbc8ff9b6dcd453563c4745778576342862ca3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/lib/corelib/language/moduleloader.cpp | 3 | ||||
-rw-r--r-- | src/lib/corelib/language/moduleloader.h | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/no-such-profile/no-such-profile.qbs | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 10 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
5 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 1cc894232..6449655fb 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -2087,6 +2087,8 @@ void ModuleLoader::checkProjectNamesInOverrides(const ModuleLoader::TopLevelProj void ModuleLoader::checkProductNamesInOverrides() { for (const QString &productNameInOverride : m_productNamesUsedInOverrides) { + if (m_erroneousProducts.contains(productNameInOverride)) + continue; bool found = false; for (auto it = m_productsByName.cbegin(); it != m_productsByName.cend(); ++it) { // In an override string such as "a.b.c:d, we cannot tell whether we have a product @@ -3804,6 +3806,7 @@ void ModuleLoader::handleProductError(const ErrorInfo &error, productContext->project->result->productInfos.insert(productContext->item, productContext->info); m_disabledItems << productContext->item; + m_erroneousProducts.insert(productContext->name); } static void gatherAssignedProperties(ItemValue *iv, const QualifiedId &prefix, diff --git a/src/lib/corelib/language/moduleloader.h b/src/lib/corelib/language/moduleloader.h index eaabdd54f..ce13364d7 100644 --- a/src/lib/corelib/language/moduleloader.h +++ b/src/lib/corelib/language/moduleloader.h @@ -444,6 +444,7 @@ private: Set<QString> m_projectNamesUsedInOverrides; Set<QString> m_productNamesUsedInOverrides; Set<QString> m_disabledProjects; + Set<QString> m_erroneousProducts; int m_dependencyResolvingPass = 0; }; diff --git a/tests/auto/blackbox/testdata/no-such-profile/no-such-profile.qbs b/tests/auto/blackbox/testdata/no-such-profile/no-such-profile.qbs new file mode 100644 index 000000000..8e64ba478 --- /dev/null +++ b/tests/auto/blackbox/testdata/no-such-profile/no-such-profile.qbs @@ -0,0 +1,6 @@ +import qbs + +Product { + name: "theProduct" + property int p +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 64377dab8..fbcb9f446 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -4287,6 +4287,16 @@ void TestBlackbox::noProfile() QVERIFY2(m_qbsStdout.contains("profile: none"), m_qbsStdout.constData()); } +void TestBlackbox::noSuchProfile() +{ + QDir::setCurrent(testDataDir + "/no-such-profile"); + QbsRunParameters params(QStringList("products.theProduct.p:1")); + params.profile = "jibbetnich"; + params.expectFailure = true; + QVERIFY(runQbs(params) != 0); + QVERIFY2(m_qbsStderr.contains("Profile 'jibbetnich' does not exist"), m_qbsStderr.constData()); +} + void TestBlackbox::nonBrokenFilesInBrokenProduct() { QDir::setCurrent(testDataDir + "/non-broken-files-in-broken-product"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 35ba2c5b7..87a6b1006 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -178,6 +178,7 @@ private slots: void nestedProperties(); void newOutputArtifact(); void noProfile(); + void noSuchProfile(); void nodejs(); void nonBrokenFilesInBrokenProduct(); void nonDefaultProduct(); |