diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-02-10 18:08:01 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-02-13 15:33:27 +0100 |
commit | e73f60919079fc7cb0f0ad6d50b1a364c7b0d2a6 (patch) | |
tree | 3ce15f1f9b336063d591999ce325ce28a6e21320 /src/lib/corelib/language/projectresolver.cpp | |
parent | a3634a6bbb193c47cdec887a6b29356c979961aa (diff) |
support transformers with an unknown number of outputs
To support different types of nodes in the build graph, we introduce
the base class BuildGraphNode. Artifact now derives from BuildGraphNode.
A RuleNode class is introduced that represents a rule in the build graph.
Rules are applied in the build phase and not in a pre-build phase
anymore.
The handling of moc has been revisited. The fixed automoc pre-build
phase is no more.
This is the squashed merge of a feature branch.
Task-number: QBS-370
Change-Id: If27cdc51cba8c9542e4282c2caa456faa723aeff
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib/corelib/language/projectresolver.cpp')
-rw-r--r-- | src/lib/corelib/language/projectresolver.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index a5d952efd..4dcec436d 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -576,26 +576,44 @@ void ProjectResolver::resolveRule(Item *item, ProjectContext *projectContext) RulePtr rule = Rule::create(); // read artifacts + bool hasArtifactChildren = false; bool hasAlwaysUpdatedArtifact = false; foreach (Item *child, item->children()) { if (Q_UNLIKELY(child->typeName() != QLatin1String("Artifact"))) throw ErrorInfo(Tr::tr("'Rule' can only have children of type 'Artifact'."), child->location()); + hasArtifactChildren = true; resolveRuleArtifact(rule, child, &hasAlwaysUpdatedArtifact); } - if (Q_UNLIKELY(!hasAlwaysUpdatedArtifact)) + if (Q_UNLIKELY(hasArtifactChildren && !hasAlwaysUpdatedArtifact)) throw ErrorInfo(Tr::tr("At least one output artifact of a rule " "must have alwaysUpdated set to true."), item->location()); + rule->name = m_evaluator->stringValue(item, QLatin1String("name")); rule->prepareScript = scriptFunctionValue(item, QLatin1String("prepare")); + rule->outputArtifactsScript = scriptFunctionValue(item, QLatin1String("outputArtifacts")); + if (rule->outputArtifactsScript->isValid()) { + if (hasArtifactChildren) + throw ErrorInfo(Tr::tr("The Rule.outputArtifacts script is not allowed in rules " + "that contain Artifact items."), + item->location()); + rule->outputFileTags = m_evaluator->fileTagsValue(item, "outputFileTags"); + if (rule->outputFileTags.isEmpty()) + throw ErrorInfo(Tr::tr("Rule.outputFileTags must be specified if " + "Rule.outputArtifacts is specified."), + item->location()); + } + rule->multiplex = m_evaluator->boolValue(item, QLatin1String("multiplex")); rule->inputs = m_evaluator->fileTagsValue(item, QLatin1String("inputs")); rule->usings = m_evaluator->fileTagsValue(item, QLatin1String("usings")); rule->auxiliaryInputs = m_evaluator->fileTagsValue(item, QLatin1String("auxiliaryInputs")); + rule->excludedAuxiliaryInputs + = m_evaluator->fileTagsValue(item, QLatin1String("excludedAuxiliaryInputs")); rule->explicitlyDependsOn = m_evaluator->fileTagsValue(item, QLatin1String("explicitlyDependsOn")); rule->module = m_moduleContext ? m_moduleContext->module : projectContext->dummyModule; |