aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/productbuilddata.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-07-16 17:30:01 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-07-17 13:08:11 +0200
commit32c4d3d7d26937c8f2a0f2f99add2eb0b0f1e503 (patch)
treeb61d49ff5ec5730040404e31f4edc7563000ef34 /src/lib/corelib/buildgraph/productbuilddata.cpp
parent1c982622acd9e38096dd9feabe8e5a4c129df31c (diff)
fix calculation of added/removed artifacts
We kept lists of added and removed artifacts in ProductBuildData. It was never quite clear when to invalidate those lists, which led to QBS-635. Instead we let the RuleNode decide which artifacts it considers as "added or removed for this rule". Task-number: QBS-635 Change-Id: I390e0ab775c695045c6e91ade3ac7326692cb314 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib/corelib/buildgraph/productbuilddata.cpp')
-rw-r--r--src/lib/corelib/buildgraph/productbuilddata.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/corelib/buildgraph/productbuilddata.cpp b/src/lib/corelib/buildgraph/productbuilddata.cpp
index 5cdf69923..abea2c861 100644
--- a/src/lib/corelib/buildgraph/productbuilddata.cpp
+++ b/src/lib/corelib/buildgraph/productbuilddata.cpp
@@ -78,8 +78,6 @@ void ProductBuildData::load(PersistentPool &pool)
rescuableArtifactData.insert(filePath, elem);
}
loadArtifactSetByFileTag(pool, artifactsByFileTag);
- loadArtifactSetByFileTag(pool, addedArtifactsByFileTag);
- loadArtifactSetByFileTag(pool, removedArtifactsByFileTag);
pool.stream() >> count;
for (int i = 0; i < count; ++i) {
@@ -112,8 +110,6 @@ void ProductBuildData::store(PersistentPool &pool) const
it.value().store(pool);
}
storeArtifactSetByFileTag(pool, artifactsByFileTag);
- storeArtifactSetByFileTag(pool, addedArtifactsByFileTag);
- storeArtifactSetByFileTag(pool, removedArtifactsByFileTag);
pool.stream() << artifactsWithChangedInputsPerRule.count();
for (ArtifactSetByRule::ConstIterator it = artifactsWithChangedInputsPerRule.constBegin();
@@ -129,14 +125,21 @@ void addArtifactToSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag
container[tag] += artifact;
}
+void removeArtifactFromSetByFileTag(Artifact *artifact, const FileTag &fileTag,
+ ProductBuildData::ArtifactSetByFileTag &container)
+{
+ ProductBuildData::ArtifactSetByFileTag::iterator it = container.find(fileTag);
+ if (it == container.end())
+ return;
+ it->remove(artifact);
+ if (it->isEmpty())
+ container.erase(it);
+}
+
void removeArtifactFromSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag &container)
{
- foreach (const FileTag &t, artifact->fileTags) {
- ArtifactSet &s = container[t];
- s.remove(artifact);
- if (s.isEmpty())
- container.remove(t);
- }
+ foreach (const FileTag &t, artifact->fileTags)
+ removeArtifactFromSetByFileTag(artifact, t, container);
}
} // namespace Internal