aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2019-09-23 20:30:04 +0200
committerRichard Weickelt <richard@weickelt.de>2019-09-25 15:36:42 +0000
commite86375117120f8c7b06afa573d9772d3c783f737 (patch)
tree14e71f4e59979dc379889539bc1df0a507336136
parent92dcda11cc01927580eb6d9818818bc673206617 (diff)
Evaluate probes before Profile items
Profile items can reference project properties, but accessing properties of project-level probes failed. This patch ensures that probes are executed before Profile items are evaluated. Fixes: QBS-1490 Change-Id: I5c215b91ded51ac895e433faa2e6fcfbc3d3e212 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/lib/corelib/language/moduleloader.cpp6
-rw-r--r--tests/auto/api/testdata/project-with-probe-and-profile-item/project-with-probe-and-profile-item.qbs19
-rw-r--r--tests/auto/api/tst_api.cpp6
-rw-r--r--tests/auto/api/tst_api.h1
4 files changed, 29 insertions, 3 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index 67d60e05d..9c8f9da1d 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()));
}
+ resolveProbes(&dummyProductContext, projectItem);
+ projectContext.topLevelProject->probes << dummyProductContext.info.probes;
+
handleProfileItems(projectItem, &projectContext);
QList<Item *> multiplexedProducts;
@@ -699,9 +702,6 @@ void ModuleLoader::handleProject(ModuleLoaderResult *loadResult,
for (Item * const additionalProductItem : qAsConst(multiplexedProducts))
Item::addChild(projectItem, additionalProductItem);
- resolveProbes(&dummyProductContext, projectItem);
- projectContext.topLevelProject->probes << dummyProductContext.info.probes;
-
const QList<Item *> originalChildren = projectItem->children();
for (Item * const child : originalChildren) {
switch (child->type()) {
diff --git a/tests/auto/api/testdata/project-with-probe-and-profile-item/project-with-probe-and-profile-item.qbs b/tests/auto/api/testdata/project-with-probe-and-profile-item/project-with-probe-and-profile-item.qbs
new file mode 100644
index 000000000..d7dc02cc2
--- /dev/null
+++ b/tests/auto/api/testdata/project-with-probe-and-profile-item/project-with-probe-and-profile-item.qbs
@@ -0,0 +1,19 @@
+Project {
+
+ property bool probesEvaluated: probe.found
+
+ Probe {
+ id: probe
+ configure: {
+ found = true;
+ }
+ }
+
+ Profile {
+ name: "the-profile"
+ cpp.includePaths: {
+ if (!probesEvaluated)
+ throw "project-level probes not evaluated";
+ }
+ }
+}
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 05cfc728f..235f2ac04 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -2374,6 +2374,12 @@ void TestApi::projectWithPropertiesItem()
VERIFY_NO_ERROR(errorInfo);
}
+void TestApi::projectWithProbeAndProfileItem()
+{
+ const qbs::ErrorInfo errorInfo = doBuildProject("project-with-probe-and-profile-item");
+ VERIFY_NO_ERROR(errorInfo);
+}
+
void TestApi::propertiesBlocks()
{
const qbs::ErrorInfo errorInfo = doBuildProject("properties-blocks");
diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h
index ce1678133..aa00ddc99 100644
--- a/tests/auto/api/tst_api.h
+++ b/tests/auto/api/tst_api.h
@@ -122,6 +122,7 @@ private slots:
void projectLocking();
void projectPropertiesByName();
void projectWithPropertiesItem();
+ void projectWithProbeAndProfileItem();
void propertiesBlocks();
void rc();
void referencedFileErrors();