summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/buildgraphloader.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2013-11-20 18:16:34 +0100
committerChristian Kandeler <christian.kandeler@digia.com>2013-11-25 12:15:02 +0100
commit9ad4bc2401dd3d3be8b6c4407666b9ea1973dbb5 (patch)
tree84477d04987b7ac48541dbd2b9ed0bdb3ab90037 /src/lib/buildgraph/buildgraphloader.cpp
parent8e1cba759fa91d2537bed76eb604c6a26df415b2 (diff)
downloadqbs-9ad4bc2401dd3d3be8b6c4407666b9ea1973dbb5.tar.gz
API: Allow to remove files from a product.
Task-number: QBS-20 Change-Id: Ia8b8c4745e8e68ec219e16876fb630d02453425b Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/buildgraph/buildgraphloader.cpp')
-rw-r--r--src/lib/buildgraph/buildgraphloader.cpp35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/lib/buildgraph/buildgraphloader.cpp b/src/lib/buildgraph/buildgraphloader.cpp
index 94ce07f57..8c3639104 100644
--- a/src/lib/buildgraph/buildgraphloader.cpp
+++ b/src/lib/buildgraph/buildgraphloader.cpp
@@ -548,7 +548,9 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
Artifact *artifact
= lookupArtifact(restoredProduct, oldBuildData, a->absoluteFilePath, true);
QBS_CHECK(artifact);
- removeArtifactAndExclusiveDependents(artifact, &artifactsToRemove);
+ newlyResolvedProduct->topLevelProject()->buildData
+ ->removeArtifactAndExclusiveDependents(artifact, m_logger, true,
+ &artifactsToRemove);
continue;
}
@@ -574,7 +576,9 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
foreach (Artifact *parent, artifact->parents) {
if (parent->transformer && parent->transformer->rule->inputs.contains(removedFileTag)) {
// this parent has been created because of the removed filetag
- removeArtifactAndExclusiveDependents(parent, &artifactsToRemove);
+ newlyResolvedProduct->topLevelProject()->buildData
+ ->removeArtifactAndExclusiveDependents(parent, m_logger, true,
+ &artifactsToRemove);
}
}
}
@@ -602,33 +606,6 @@ void BuildGraphLoader::onProductFileListChanged(const ResolvedProductPtr &restor
}
}
-/**
- * Removes the artifact and all the artifacts that depend exclusively on it.
- * Example: if you remove a cpp artifact then the obj artifact is removed but
- * not the resulting application (if there's more then one cpp artifact).
- */
-void BuildGraphLoader::removeArtifactAndExclusiveDependents(Artifact *artifact,
- ArtifactList *removedArtifacts)
-{
- if (removedArtifacts)
- removedArtifacts->insert(artifact);
- TopLevelProject * const project = artifact->product->topLevelProject();
- foreach (Artifact *parent, artifact->parents) {
- bool removeParent = false;
- disconnect(parent, artifact, m_logger);
- if (parent->children.isEmpty()) {
- removeParent = true;
- } else if (parent->transformer) {
- project->buildData->artifactsThatMustGetNewTransformers += parent;
- parent->transformer->inputs.remove(artifact);
- removeParent = parent->transformer->inputs.isEmpty();
- }
- if (removeParent)
- removeArtifactAndExclusiveDependents(parent, removedArtifacts);
- }
- project->buildData->removeArtifact(artifact, m_logger);
-}
-
static SourceArtifactConstPtr findSourceArtifact(const ResolvedProductConstPtr &product,
const QString &artifactFilePath, QMap<QString, SourceArtifactConstPtr> &artifactMap)
{