diff options
Diffstat (limited to 'src/lib/corelib/buildgraph')
-rw-r--r-- | src/lib/corelib/buildgraph/executor.cpp | 23 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/executor.h | 1 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index be5a93302..2706d0323 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -408,6 +408,9 @@ void Executor::buildArtifact(Artifact *artifact) QBS_CHECK(artifact->buildState == BuildGraphNode::Buildable); + if (artifact->artifactType != Artifact::SourceFile && !checkNodeProduct(artifact)) + return; + // skip artifacts without transformer if (artifact->artifactType != Artifact::Generated) { // For source artifacts, that were not reachable when initializing the build, we must @@ -430,6 +433,9 @@ void Executor::buildArtifact(Artifact *artifact) void Executor::executeRuleNode(RuleNode *ruleNode) { + if (!checkNodeProduct(ruleNode)) + return; + QBS_CHECK(!m_evalContext->isActive()); ArtifactSet changedInputArtifacts; if (ruleNode->rule()->isDynamic()) { @@ -972,6 +978,20 @@ void Executor::checkForUnbuiltProducts() } } +bool Executor::checkNodeProduct(BuildGraphNode *node) +{ + if (m_productsToBuild.contains(node->product)) + return true; + + // TODO: Turn this into a warning once we have a reliable C++ scanner. + m_logger.qbsTrace() << "Ignoring node " << node->toString() << ", which belongs to a " + "product that is not part of the list of products to build. " + "Possible reasons are an erroneous project design or a false " + "positive from a dependency scanner."; + finishNode(node); + return false; +} + void Executor::finish() { QBS_ASSERT(m_state != ExecutorIdle, /* ignore */); @@ -1007,8 +1027,6 @@ void Executor::checkForCancellation() bool Executor::visit(Artifact *artifact) { QBS_CHECK(artifact->buildState != BuildGraphNode::Untouched); - QBS_CHECK(artifact->artifactType == Artifact::SourceFile - || m_productsToBuild.contains(artifact->product)); buildArtifact(artifact); return false; } @@ -1016,7 +1034,6 @@ bool Executor::visit(Artifact *artifact) bool Executor::visit(RuleNode *ruleNode) { QBS_CHECK(ruleNode->buildState != BuildGraphNode::Untouched); - QBS_CHECK(m_productsToBuild.contains(ruleNode->product)); executeRuleNode(ruleNode); return false; } diff --git a/src/lib/corelib/buildgraph/executor.h b/src/lib/corelib/buildgraph/executor.h index d626cca3d..2018357b6 100644 --- a/src/lib/corelib/buildgraph/executor.h +++ b/src/lib/corelib/buildgraph/executor.h @@ -131,6 +131,7 @@ private: void finishTransformer(const TransformerPtr &transformer); void possiblyInstallArtifact(const Artifact *artifact); void checkForUnbuiltProducts(); + bool checkNodeProduct(BuildGraphNode *node); bool mustExecuteTransformer(const TransformerPtr &transformer) const; bool isUpToDate(Artifact *artifact) const; |