aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/artifactcleaner.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-08-21 12:46:42 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-08-31 08:22:14 +0000
commitfb0f175ec1ca0ed91784f680f87b0f3aa77adf96 (patch)
treededd5bf2f95b1ae5b41ecccf346c9ffec85be369 /src/lib/corelib/buildgraph/artifactcleaner.cpp
parenta34e10961d4b502bf63099084ae230e25a927754 (diff)
Fix cleaning of rescuable artifacts.
The following sequence was problematic: 1) qbs build someModuleProperty:true 2) qbs resolve someModuleProperty:false 3) qbs clean Step 2) causes the artifact objects to get removed from the build graph and their relevant information stored in the list of rescuable artifact data, so that on the next build the files will either get re-created as artifacts or removed from the disk, depending on whether the changed property causes their transformer command to change. The problem was that the ArtifactCleaner only looked at the build graph and was not aware of rescuable artifact data. With this patch, we go through the list of rescuable artifacts and remove the entries from that list as well as from the disk. Change-Id: I05348fa1e92268c58f75074ea99371e39cc662f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/lib/corelib/buildgraph/artifactcleaner.cpp')
-rw-r--r--src/lib/corelib/buildgraph/artifactcleaner.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/corelib/buildgraph/artifactcleaner.cpp b/src/lib/corelib/buildgraph/artifactcleaner.cpp
index afb35d9dc..6dcc79b2a 100644
--- a/src/lib/corelib/buildgraph/artifactcleaner.cpp
+++ b/src/lib/corelib/buildgraph/artifactcleaner.cpp
@@ -99,10 +99,23 @@ public:
{
}
- void visitProduct(const ResolvedProductConstPtr &product)
+ void visitProduct(const ResolvedProductPtr &product)
{
m_product = product;
ArtifactVisitor::visitProduct(product);
+ auto it = product->buildData->rescuableArtifactData.begin();
+ while (it != product->buildData->rescuableArtifactData.end()) {
+ // TODO: This does not respect CleanOptions::cleanType(), because the information
+ // about whether an artifact is a target artifact is not stored in the RAD structure.
+ // Rather than add it there, we should get rid of the CleanType altogether, as it
+ // makes little sense.
+ Artifact tmp;
+ tmp.product = product;
+ tmp.setFilePath(it.key());
+ tmp.setTimestamp(it.value().timeStamp);
+ removeArtifactFromDisk(&tmp, m_options.dryRun(), m_logger);
+ it = product->buildData->rescuableArtifactData.erase(it);
+ }
}
const QSet<QString> &directories() const { return m_directories; }