diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2013-12-11 18:45:55 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-12-12 10:02:07 +0100 |
commit | 928f81c194d43155d50f654df70347405ad236ff (patch) | |
tree | 5c81dfe2f26110f76bb28a8d97dd80f9e7147f48 | |
parent | f8f985af535712e051be28883aef9199cde3b022 (diff) |
Fix artifact cleaner.
If the "remove all" flag is not set, we must take care to not only skip
target artifacts, but also their siblings that are not target artifacts.
Otherwise, the build graph can end up in an unexpected state.
Change-Id: Ie2fa36f3e489c3bee19f461e16fa093515b01020
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r-- | src/lib/buildgraph/artifactcleaner.cpp | 11 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/buildgraph/artifactcleaner.cpp b/src/lib/buildgraph/artifactcleaner.cpp index 7e9a449d4..7a2056a8c 100644 --- a/src/lib/buildgraph/artifactcleaner.cpp +++ b/src/lib/buildgraph/artifactcleaner.cpp @@ -32,6 +32,7 @@ #include "artifactvisitor.h" #include "productbuilddata.h" #include "projectbuilddata.h" +#include "transformer.h" #include <language/language.h> #include <logging/translator.h> @@ -39,6 +40,7 @@ #include <tools/error.h> #include <tools/fileinfo.h> #include <tools/progressobserver.h> +#include <tools/qbsassert.h> #include <QCoreApplication> #include <QDir> @@ -108,9 +110,12 @@ private: { if (artifact->product != m_product) return; - if (artifact->product->buildData->targetArtifacts.contains(artifact) - && m_options.cleanType() == CleanOptions::CleanupTemporaries) { - return; + if (m_options.cleanType() == CleanOptions::CleanupTemporaries) { + QBS_CHECK(artifact->transformer); + foreach (Artifact * const sibling, artifact->transformer->outputs) { + if (artifact->product->buildData->targetArtifacts.contains(sibling)) + return; + } } try { removeArtifactFromDisk(artifact, m_options.dryRun(), m_logger); diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 90b8a6c88..f3d9e4172 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -395,7 +395,7 @@ void TestBlackbox::clean() QVERIFY(!QFile(depObjectFilePath).exists()); QVERIFY(QFile(depLibFilePath).exists()); foreach (const QString &symLink, symlinks) - QVERIFY2(!QFile(symLink).exists(), qPrintable(symLink)); + QVERIFY2(QFile(symLink).exists(), qPrintable(symLink)); // Remove all. QCOMPARE(runQbs(), 0); |