diff options
| author | Christian Kandeler <christian.kandeler@digia.com> | 2013-11-11 16:05:22 +0100 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-11-11 17:03:20 +0100 |
| commit | 78fcaf4814c95f0a0c09c09857f45f011014fa8b (patch) | |
| tree | a6e53385c8cd825bfe0840be5b40d7165163fc2a /src/lib/buildgraph/buildgraphloader.cpp | |
| parent | 7cd6a4d78fabcec0197fb62b5a1458f3d9916fd8 (diff) | |
| download | qbs-78fcaf4814c95f0a0c09c09857f45f011014fa8b.tar.gz | |
Fix bug in rescuing build data.
We tried to get information about an artifact's children from the
artifact itself. However, that artifact could have gotten disconnected
along the way and not know anything about its children anymore.
We must therefore save such information in an extra data structure.
Change-Id: Id2043f97e857bf8779184e88b1425fdcf85e3f2e
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/buildgraph/buildgraphloader.cpp')
| -rw-r--r-- | src/lib/buildgraph/buildgraphloader.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/buildgraph/buildgraphloader.cpp b/src/lib/buildgraph/buildgraphloader.cpp index aa2a5090e..121cb7ca2 100644 --- a/src/lib/buildgraph/buildgraphloader.cpp +++ b/src/lib/buildgraph/buildgraphloader.cpp @@ -205,9 +205,19 @@ void BuildGraphLoader::trackProjectChanges(const SetupProjectParameters ¶met productsWithChangedFiles); QSharedPointer<ProjectBuildData> oldBuildData; + ChildListHash childLists; if (!changedProducts.isEmpty() || !productsWithChangedFiles.isEmpty()) { oldBuildData = QSharedPointer<ProjectBuildData>( new ProjectBuildData(restoredProject->buildData.data())); + foreach (const ResolvedProductConstPtr &product, allRestoredProducts) { + if (!product->buildData) + continue; + + // If the product gets temporarily removed, its artifacts will get disconnected + // and this structural information will no longer be directly available from them. + foreach (const Artifact * const a, product->buildData->artifacts) + childLists.insert(a, a->children); + } } // For products with "serious" changes such as different prepare scripts, we set up the @@ -285,7 +295,7 @@ void BuildGraphLoader::trackProjectChanges(const SetupProjectParameters ¶met foreach (const ResolvedProductConstPtr &changedProduct, changedProducts) { rescueOldBuildData(changedProduct, freshProductsByName.value(changedProduct->name), - oldBuildData.data()); + oldBuildData.data(), childLists); } doSanityChecks(m_result.newlyResolvedProject, m_logger); @@ -700,7 +710,7 @@ static bool commandsEqual(const TransformerConstPtr &t1, const TransformerConstP */ void BuildGraphLoader::rescueOldBuildData(const ResolvedProductConstPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct, - const ProjectBuildData *oldBuildData) + const ProjectBuildData *oldBuildData, const ChildListHash &childLists) { if (!restoredProduct->enabled || !newlyResolvedProduct->enabled) return; @@ -733,11 +743,7 @@ void BuildGraphLoader::rescueOldBuildData(const ResolvedProductConstPtr &restore } artifact->setTimestamp(oldArtifact->timestamp()); - foreach (Artifact * const oldChild, oldArtifact->children) { - // skip transform edges - if (oldArtifact->transformer->inputs.contains(oldChild)) - continue; - + foreach (Artifact * const oldChild, childLists.value(oldArtifact)) { foreach (FileResourceBase *childFileRes, newlyResolvedProduct->topLevelProject()->buildData->lookupFiles(oldChild)) { Artifact * const child = dynamic_cast<Artifact *>(childFileRes); |
