diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-09-17 08:42:21 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-09-18 10:19:13 +0200 |
commit | e8d3ee487330f50c06a411e6ba52ca4b304db4cf (patch) | |
tree | f6f4d7954c5b4f609273c767da2b3a54e369ab56 /src | |
parent | 37f23c0a86403247d74ace9f30f00a0bab9df346 (diff) | |
download | qbs-e8d3ee487330f50c06a411e6ba52ca4b304db4cf.tar.gz |
Transformer.explicitlyDependsOn added
Change-Id: If4f695878087f0cd72d85e497d918c4f70e42001
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/buildgraph/projectbuilddata.cpp | 16 | ||||
-rw-r--r-- | src/lib/language/builtindeclarations.cpp | 2 | ||||
-rw-r--r-- | src/lib/language/language.h | 1 | ||||
-rw-r--r-- | src/lib/language/projectresolver.cpp | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/buildgraph/projectbuilddata.cpp b/src/lib/buildgraph/projectbuilddata.cpp index bc2f74735..452a99675 100644 --- a/src/lib/buildgraph/projectbuilddata.cpp +++ b/src/lib/buildgraph/projectbuilddata.cpp @@ -284,6 +284,8 @@ void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &produc } // read manually added transformers + typedef QPair<ResolvedTransformerConstPtr, TransformerConstPtr> TrafoPair; + QList<TrafoPair> trafos; foreach (const ResolvedTransformerConstPtr &rtrafo, product->transformers) { ArtifactList inputArtifacts; foreach (const QString &inputFileName, rtrafo->inputs) { @@ -293,6 +295,7 @@ void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &produc inputArtifacts += artifact; } TransformerPtr transformer = Transformer::create(); + trafos += TrafoPair(rtrafo, transformer); transformer->inputs = inputArtifacts; const RulePtr rule = Rule::create(); rule->jsImports = rtrafo->jsImports; @@ -328,6 +331,19 @@ void BuildDataResolver::resolveProductBuildData(const ResolvedProductPtr &produc throw ErrorInfo(QString("There's a transformer without commands."), rtrafo->transform->location); } + // Handle Transformer.explicitlyDependsOn after all transformer outputs have been created. + foreach (const TrafoPair &p, trafos) { + const ResolvedTransformerConstPtr &rtrafo = p.first; + const TransformerConstPtr &trafo = p.second; + foreach (const FileTag &tag, rtrafo->explicitlyDependsOn) { + foreach (Artifact *output, trafo->outputs) { + foreach (Artifact *dependency, artifactsPerFileTag.value(tag)) { + loggedConnect(output, dependency, m_logger); + } + } + } + } + RulesApplicator(product, artifactsPerFileTag, m_logger).applyAllRules(); addTargetArtifacts(product, artifactsPerFileTag, m_logger); } diff --git a/src/lib/language/builtindeclarations.cpp b/src/lib/language/builtindeclarations.cpp index 38d6f8a97..ee1766320 100644 --- a/src/lib/language/builtindeclarations.cpp +++ b/src/lib/language/builtindeclarations.cpp @@ -323,6 +323,8 @@ void BuiltinDeclarations::addTransformerItem() properties += conditionProperty(); properties += PropertyDeclaration(QLatin1String("inputs"), PropertyDeclaration::Variant); properties += PropertyDeclaration(QLatin1String("prepare"), PropertyDeclaration::Verbatim); + properties += PropertyDeclaration(QLatin1String("explicitlyDependsOn"), + PropertyDeclaration::StringList); m_builtins[QLatin1String("Transformer")] = properties; } diff --git a/src/lib/language/language.h b/src/lib/language/language.h index 26c91177c..cf8ae0228 100644 --- a/src/lib/language/language.h +++ b/src/lib/language/language.h @@ -280,6 +280,7 @@ public: QStringList inputs; QList<SourceArtifactPtr> outputs; ScriptFunctionConstPtr transform; + FileTags explicitlyDependsOn; JsImports jsImports; QStringList jsExtensions; diff --git a/src/lib/language/projectresolver.cpp b/src/lib/language/projectresolver.cpp index 9400b365b..36777de47 100644 --- a/src/lib/language/projectresolver.cpp +++ b/src/lib/language/projectresolver.cpp @@ -634,6 +634,7 @@ void ProjectResolver::resolveTransformer(Item *item, ProjectContext *projectCont for (int i = 0; i < rtrafo->inputs.count(); ++i) rtrafo->inputs[i] = FileInfo::resolvePath(m_productContext->product->sourceDirectory, rtrafo->inputs.at(i)); rtrafo->transform = scriptFunctionValue(item, QLatin1String("prepare")); + rtrafo->explicitlyDependsOn = m_evaluator->fileTagsValue(item, "explicitlyDependsOn"); foreach (const Item *child, item->children()) { if (Q_UNLIKELY(child->typeName() != QLatin1String("Artifact"))) |