diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-12 11:55:45 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-12 12:16:18 +0000 |
commit | 20e4b95fbe8ea23ce39195c63b6b8294eef7b0ee (patch) | |
tree | cd3faa1eab919a0d3d6aa660063fc08eccd8aeb1 /src/lib/corelib/buildgraph/rulesapplicator.cpp | |
parent | 356e3a633924dceebe4aed5d236cd8bdd2f1d7d3 (diff) |
Make sure every input artifact is connected to its rule node
The old code did that only upon output artifact creation, which meant
that source artifacts that became inputs to a rule that had already run
were not added to that rule node as a child.
Change-Id: I4998cbc54abbbcbf0cb2feafd34f2ee44d6d329d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/rulesapplicator.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/rulesapplicator.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/lib/corelib/buildgraph/rulesapplicator.cpp b/src/lib/corelib/buildgraph/rulesapplicator.cpp index 5962eb346..b0b0a9461 100644 --- a/src/lib/corelib/buildgraph/rulesapplicator.cpp +++ b/src/lib/corelib/buildgraph/rulesapplicator.cpp @@ -44,6 +44,7 @@ #include "projectbuilddata.h" #include "qtmocscanner.h" #include "rulecommands.h" +#include "rulenode.h" #include "rulesevaluationcontext.h" #include "transformer.h" #include "transformerchangetracking.h" @@ -93,19 +94,19 @@ RulesApplicator::~RulesApplicator() delete m_mocScanner; } -void RulesApplicator::applyRule(const RuleConstPtr &rule, const ArtifactSet &inputArtifacts) +void RulesApplicator::applyRule(RuleNode *ruleNode, const ArtifactSet &inputArtifacts) { - if (inputArtifacts.empty() && rule->declaresInputs() && rule->requiresInputs) - return; + m_ruleNode = ruleNode; + m_rule = ruleNode->rule(); + QBS_CHECK(!inputArtifacts.empty() || !m_rule->declaresInputs() || !m_rule->requiresInputs); m_product->topLevelProject()->buildData->setDirty(); m_createdArtifacts.clear(); m_invalidatedArtifacts.clear(); RulesEvaluationContext::Scope s(evalContext().get()); - m_rule = rule; m_completeInputSet = inputArtifacts; - if (rule->name == QLatin1String("QtCoreMocRule")) { + if (m_rule->name == QLatin1String("QtCoreMocRule")) { delete m_mocScanner; m_mocScanner = new QtMocScanner(m_product, scope()); } @@ -229,6 +230,16 @@ void RulesApplicator::doApply(const ArtifactSet &inputArtifacts, QScriptValue &p if (outputArtifacts.empty()) return; + // The inputs become children of the rule node. Generated artifacts in the same product + // already are children, because output artifacts become children of the producing + // rule node's parent rule node. + for (Artifact * const input : inputArtifacts) { + if (input->artifactType == Artifact::SourceFile || input->product != m_ruleNode->product) + connect(m_ruleNode, input); + else + QBS_CHECK(m_ruleNode->children.contains(input)); + } + for (Artifact * const outputArtifact : qAsConst(outputArtifacts)) { for (Artifact * const dependency : qAsConst(m_transformer->explicitlyDependsOn)) connect(outputArtifact, dependency); |