From a0dd0a13db1004ca86cf257ebbd9c3e714da32ea Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 7 Nov 2013 14:35:02 +0100 Subject: Take rules into account when tracking changes. This will cause rebuilding if, for example, a rule in a module that the product uses gets its source code changed (and the rule is actually being used). Change-Id: I009685c85fcc8fa0ae3ecc7c32194685a1558104 Reviewed-by: Joerg Bornemann --- src/lib/buildgraph/buildgraphloader.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib/buildgraph') diff --git a/src/lib/buildgraph/buildgraphloader.cpp b/src/lib/buildgraph/buildgraphloader.cpp index 130784b31..aa2a5090e 100644 --- a/src/lib/buildgraph/buildgraphloader.cpp +++ b/src/lib/buildgraph/buildgraphloader.cpp @@ -413,6 +413,8 @@ bool BuildGraphLoader::checkProductForChanges(const ResolvedProductPtr &restored { return !transformerListsAreEqual(restoredProduct->transformers, newlyResolvedProduct->transformers) + || !ruleListsAreEqual(restoredProduct->rules.toList(), + newlyResolvedProduct->rules.toList()) || !dependenciesAreEqual(restoredProduct, newlyResolvedProduct) || checkForPropertyChanges(restoredProduct, newlyResolvedProduct); // TODO: Check for more stuff. -- cgit v1.2.1 From 78fcaf4814c95f0a0c09c09857f45f011014fa8b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 11 Nov 2013 16:05:22 +0100 Subject: 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 --- src/lib/buildgraph/buildgraphloader.cpp | 20 +++++++++++++------- src/lib/buildgraph/buildgraphloader.h | 7 +++++-- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'src/lib/buildgraph') 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 oldBuildData; + ChildListHash childLists; if (!changedProducts.isEmpty() || !productsWithChangedFiles.isEmpty()) { oldBuildData = QSharedPointer( 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(childFileRes); diff --git a/src/lib/buildgraph/buildgraphloader.h b/src/lib/buildgraph/buildgraphloader.h index f13749f26..4806daad3 100644 --- a/src/lib/buildgraph/buildgraphloader.h +++ b/src/lib/buildgraph/buildgraphloader.h @@ -31,6 +31,7 @@ #include "forward_decls.h" +#include #include #include @@ -41,7 +42,6 @@ namespace qbs { class SetupProjectParameters; namespace Internal { -class ArtifactList; class FileDependency; class FileResourceBase; class FileTime; @@ -97,9 +97,12 @@ private: const PropertyMapConstPtr &newProperties); void replaceFileDependencyWithArtifact(const ResolvedProductPtr &fileDepProduct, FileDependency *filedep, Artifact *artifact); + + typedef QHash ChildListHash; void rescueOldBuildData(const ResolvedProductConstPtr &restoredProduct, const ResolvedProductPtr &newlyResolvedProduct, - const ProjectBuildData *oldBuildData); + const ProjectBuildData *oldBuildData, + const ChildListHash &childLists); RulesEvaluationContextPtr m_evalContext; BuildGraphLoadResult m_result; -- cgit v1.2.1