diff options
author | Richard Weickelt <richard@weickelt.de> | 2020-02-04 20:35:59 +0100 |
---|---|---|
committer | Richard Weickelt <richard@weickelt.de> | 2020-02-05 11:26:36 +0000 |
commit | bf059105305fd33440940338a7aeb67ec75cb18e (patch) | |
tree | 96bf155ab8898e943b00ad94fa937ab8441258da | |
parent | e67398af5c09fc51f90db4b519805b150db5f3ac (diff) |
Fix probes referencing project properties1.15
This patch fixes a regression introduced in e8637511. Probes in Project items
could no longer reference project properties by writing project.xxx on the
right hand side of a property assignment expression.
Change-Id: I7d04c71f4c493481a00411f12666bd6c2caa8caa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | src/lib/corelib/language/moduleloader.cpp | 4 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs | 51 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 3 |
3 files changed, 37 insertions, 21 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 9c8f9da1d..9c7f2b3a4 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -688,6 +688,9 @@ void ModuleLoader::handleProject(ModuleLoaderResult *loadResult, m_qbsVersion.toString())); } + for (Item * const child : projectItem->children()) + child->setScope(projectContext.scope); + resolveProbes(&dummyProductContext, projectItem); projectContext.topLevelProject->probes << dummyProductContext.info.probes; @@ -695,7 +698,6 @@ void ModuleLoader::handleProject(ModuleLoaderResult *loadResult, QList<Item *> multiplexedProducts; for (Item * const child : projectItem->children()) { - child->setScope(projectContext.scope); if (child->type() == ItemType::Product) multiplexedProducts << multiplexProductItem(&dummyProductContext, child); } diff --git a/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs b/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs index 9846eacef..ce89d11f4 100644 --- a/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs +++ b/tests/auto/blackbox/testdata/probeProperties/probeProperties.qbs @@ -1,29 +1,40 @@ import qbs.Probes -CppApplication { - Probes.PathProbe { - id: probe1 - names: ["bin/tool"] - platformSearchPaths: [product.sourceDirectory] - } +Project { - Probes.PathProbe { - id: probe2 - names: ["tool"] - platformSearchPaths: [product.sourceDirectory + "/bin"] - } + CppApplication { + Probes.PathProbe { + id: probe1 + names: ["bin/tool"] + platformSearchPaths: [product.sourceDirectory] + } - targetName: { - console.info("probe1.fileName=" + probe1.fileName); - console.info("probe1.path=" + probe1.path); - console.info("probe1.filePath=" + probe1.filePath); + Probes.PathProbe { + id: probe2 + names: ["tool"] + platformSearchPaths: [product.sourceDirectory + "/bin"] + } - console.info("probe2.fileName=" + probe2.fileName); - console.info("probe2.path=" + probe2.path); - console.info("probe2.filePath=" + probe2.filePath); + targetName: { + console.info("probe1.fileName=" + probe1.fileName); + console.info("probe1.path=" + probe1.path); + console.info("probe1.filePath=" + probe1.filePath); - return name; + console.info("probe2.fileName=" + probe2.fileName); + console.info("probe2.path=" + probe2.path); + console.info("probe2.filePath=" + probe2.filePath); + + console.info("probe3.fileName=" + probe3.fileName); + console.info("probe3.path=" + probe3.path); + console.info("probe3.filePath=" + probe3.filePath); + return name; + } + } + + Probes.PathProbe { + id: probe3 + names: ["tool"] + platformSearchPaths: [project.sourceDirectory + "/bin"] } - files: ["main.c"] } diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 72f610364..9cdb83fd2 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -3009,6 +3009,9 @@ void TestBlackbox::probeProperties() QVERIFY2(m_qbsStdout.contains("probe2.fileName=tool"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe2.path=" + dir + "/bin"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("probe2.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe3.fileName=tool"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe3.path=" + dir + "/bin"), m_qbsStdout.constData()); + QVERIFY2(m_qbsStdout.contains("probe3.filePath=" + dir + "/bin/tool"), m_qbsStdout.constData()); } void TestBlackbox::probesAndShadowProducts() |