summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-09-20 11:56:31 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2013-09-20 12:34:57 +0200
commitf9468db030f013d9a7d31fe73485f6b322c884af (patch)
treed0c1d016417dc1fddbb7842757917fd32f10a909 /src
parent32f42d797063cd474778301ff9759dc76ec63a91 (diff)
downloadqbs-f9468db030f013d9a7d31fe73485f6b322c884af.tar.gz
Fix handling of disabled products when restoring.
If build data already exists (i.e. the product was not disabled before), we must not swap it over to the new product, and we need to remove all the artifacts from the build graph. Change-Id: I210f8da72a7252905a6c92f3db6b2a907922f7b0 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/lib/buildgraph/buildgraphloader.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lib/buildgraph/buildgraphloader.cpp b/src/lib/buildgraph/buildgraphloader.cpp
index da3ca97c8..511ad4e51 100644
--- a/src/lib/buildgraph/buildgraphloader.cpp
+++ b/src/lib/buildgraph/buildgraphloader.cpp
@@ -229,7 +229,20 @@ void BuildGraphLoader::trackProjectChanges(const SetupProjectParameters &paramet
for (int j = allRestoredProducts.count() - 1; j >= 0; --j) {
const ResolvedProductPtr &restoredProduct = allRestoredProducts.at(j);
if (newlyResolvedProduct->name == restoredProduct->name) {
- newlyResolvedProduct->buildData.swap(restoredProduct->buildData);
+ if (newlyResolvedProduct->enabled) {
+ newlyResolvedProduct->buildData.swap(restoredProduct->buildData);
+ } else {
+ if (restoredProduct->enabled) {
+ QBS_CHECK(restoredProduct->buildData);
+ foreach (Artifact * const a, newlyResolvedProduct->buildData->artifacts) {
+ const bool removeFromDisk = a->artifactType == Artifact::Generated;
+ newlyResolvedProduct->topLevelProject()->buildData->removeArtifact(a,
+ m_logger, removeFromDisk, true);
+ m_objectsToDelete << a;
+ }
+ }
+ productsWithChangedFiles.removeOne(restoredProduct);
+ }
if (newlyResolvedProduct->buildData) {
foreach (Artifact * const a, newlyResolvedProduct->buildData->artifacts)
a->product = newlyResolvedProduct;
@@ -427,6 +440,8 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
{
m_logger.qbsDebug() << "[BG] product '" << restoredProduct->name << "' changed.";
+ QBS_CHECK(newlyResolvedProduct->enabled);
+
ArtifactsPerFileTagMap artifactsPerFileTag;
QList<Artifact *> addedArtifacts;
ArtifactList artifactsToRemove;
@@ -513,9 +528,6 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
}
}
- if (!newlyResolvedProduct->enabled)
- return;
-
// apply rules for new artifacts
foreach (Artifact *artifact, addedArtifacts)
foreach (const FileTag &ft, artifact->fileTags)