diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-06-17 11:09:46 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-06-17 10:03:30 +0000 |
commit | d40b92e506af0e97bebd13c7410553f6d74d3af2 (patch) | |
tree | 81b5023d6e28430dc308a3348801f150e21632a0 | |
parent | 8f30c42022afbd1898d7c723201f750d2f0dea39 (diff) |
Respect the "active file tags" build option also when installing.
Otherwise, we would potentially try to install artifacts that haven't
been built yet, causing invalid error messages.
Change-Id: I5e8443e477ae767aeb6846de29dd8a3bd98b9ff5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/lib/corelib/buildgraph/executor.cpp | 8 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/executor.h | 1 | ||||
-rw-r--r-- | tests/auto/api/testdata/build-single-file/project.qbs | 5 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 1 |
4 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index b9d4cc330..809db775b 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -614,13 +614,18 @@ bool Executor::transformerHasMatchingOutputTags(const TransformerConstPtr &trans return true; // No filtering requested. foreach (Artifact * const output, transformer->outputs) { - if (m_activeFileTags.matches(output->fileTags())) + if (artifactHasMatchingOutputTags(output)) return true; } return false; } +bool Executor::artifactHasMatchingOutputTags(const Artifact *artifact) const +{ + return m_activeFileTags.matches(artifact->fileTags()); +} + bool Executor::transformerHasMatchingInputFiles(const TransformerConstPtr &transformer) const { if (m_buildOptions.filesToConsider().isEmpty()) @@ -905,6 +910,7 @@ void Executor::finishTransformer(const TransformerPtr &transformer) void Executor::possiblyInstallArtifact(const Artifact *artifact) { if (m_buildOptions.install() && !m_buildOptions.executeRulesOnly() + && (m_activeFileTags.isEmpty() || artifactHasMatchingOutputTags(artifact)) && artifact->properties->qbsPropertyValue(QLatin1String("install")).toBool()) { m_productInstaller->copyFile(artifact); } diff --git a/src/lib/corelib/buildgraph/executor.h b/src/lib/corelib/buildgraph/executor.h index b3b925475..6ef4ddb0c 100644 --- a/src/lib/corelib/buildgraph/executor.h +++ b/src/lib/corelib/buildgraph/executor.h @@ -139,6 +139,7 @@ private: FileTime recursiveFileTime(const QString &filePath) const; QString configString() const; bool transformerHasMatchingOutputTags(const TransformerConstPtr &transformer) const; + bool artifactHasMatchingOutputTags(const Artifact *artifact) const; bool transformerHasMatchingInputFiles(const TransformerConstPtr &transformer) const; typedef QHash<ExecutorJob *, TransformerPtr> JobMap; diff --git a/tests/auto/api/testdata/build-single-file/project.qbs b/tests/auto/api/testdata/build-single-file/project.qbs index 2ea989922..58faaa03a 100644 --- a/tests/auto/api/testdata/build-single-file/project.qbs +++ b/tests/auto/api/testdata/build-single-file/project.qbs @@ -2,4 +2,9 @@ import qbs CppApplication { files: ["ignored1.cpp", "ignored2.cpp", "compiled.cpp"] + + Group { + fileTagsFilter: ["application"] + qbs.install: true + } } diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 5ba952490..2583964e9 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -414,7 +414,6 @@ void TestApi::buildSingleFile() QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString())); qbs::Project project = setupJob->project(); qbs::BuildOptions options; - options.setDryRun(true); options.setFilesToConsider(QStringList(setupParams.buildRoot() + "/compiled.cpp")); options.setActiveFileTags(QStringList("obj")); m_logSink->setLogLevel(qbs::LoggerMaxLevel); |