From 129f9116a4d752c46ecb275e81f02e33cc61e2d0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 11 Oct 2013 14:38:42 +0200 Subject: in the scanner, only remove connections the scanner created Task-number: QBS-394 Change-Id: I4659746be6004042949038450e2015fbb5f70b77 Reviewed-by: Christian Kandeler --- src/lib/buildgraph/artifact.cpp | 2 ++ src/lib/buildgraph/artifact.h | 1 + src/lib/buildgraph/buildgraph.cpp | 3 +++ src/lib/buildgraph/inputartifactscanner.cpp | 8 +++----- src/lib/buildgraph/projectbuilddata.cpp | 2 ++ 5 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src/lib/buildgraph') diff --git a/src/lib/buildgraph/artifact.cpp b/src/lib/buildgraph/artifact.cpp index 9583f5f02..01bad8e36 100644 --- a/src/lib/buildgraph/artifact.cpp +++ b/src/lib/buildgraph/artifact.cpp @@ -82,6 +82,7 @@ void Artifact::load(PersistentPool &pool) for (ArtifactList::const_iterator it = children.constBegin(); it != children.constEnd(); ++it) (*it)->parents.insert(this); + pool.loadContainer(childrenAddedByScanner); pool.loadContainer(fileDependencies); properties = pool.idLoadS(); transformer = pool.idLoadS(); @@ -99,6 +100,7 @@ void Artifact::store(PersistentPool &pool) const FileResourceBase::store(pool); // Do not store parents to avoid recursion. pool.storeContainer(children); + pool.storeContainer(childrenAddedByScanner); pool.storeContainer(fileDependencies); pool.store(properties); pool.store(transformer); diff --git a/src/lib/buildgraph/artifact.h b/src/lib/buildgraph/artifact.h index 0eb17741f..55b5c81bc 100644 --- a/src/lib/buildgraph/artifact.h +++ b/src/lib/buildgraph/artifact.h @@ -62,6 +62,7 @@ public: ArtifactList parents; ArtifactList children; + ArtifactList childrenAddedByScanner; QSet fileDependencies; FileTags fileTags; WeakPointer product; diff --git a/src/lib/buildgraph/buildgraph.cpp b/src/lib/buildgraph/buildgraph.cpp index 5534fe5fa..04a9d3266 100644 --- a/src/lib/buildgraph/buildgraph.cpp +++ b/src/lib/buildgraph/buildgraph.cpp @@ -291,6 +291,7 @@ void disconnect(Artifact *u, Artifact *v, const Logger &logger) .arg(relativeArtifactFileName(u), relativeArtifactFileName(v)); } u->children.remove(v); + u->childrenAddedByScanner.remove(v); v->parents.remove(u); } @@ -429,6 +430,8 @@ static void doSanityChecksForProduct(const ResolvedProductConstPtr &product, con QBS_CHECK(parent->children.contains(artifact)); foreach (const Artifact * const child, artifact->children) QBS_CHECK(child->parents.contains(artifact)); + foreach (Artifact * const child, artifact->childrenAddedByScanner) + QBS_CHECK(artifact->children.contains(child)); const TransformerConstPtr transformer = artifact->transformer; if (artifact->artifactType == Artifact::SourceFile) continue; diff --git a/src/lib/buildgraph/inputartifactscanner.cpp b/src/lib/buildgraph/inputartifactscanner.cpp index e4f50322b..f40e378fe 100644 --- a/src/lib/buildgraph/inputartifactscanner.cpp +++ b/src/lib/buildgraph/inputartifactscanner.cpp @@ -158,13 +158,10 @@ void InputArtifactScanner::scan() // clear file dependencies; they will be regenerated m_artifact->fileDependencies.clear(); - // Remove all connections to children that do not belong to our transformer. + // Remove all connections to children that were added by the dependency scanner. // They will be regenerated. - foreach (Artifact *dependency, m_artifact->children) { - if (m_artifact->transformer->inputs.contains(dependency)) - continue; + foreach (Artifact *dependency, m_artifact->childrenAddedByScanner) disconnect(m_artifact, dependency, m_logger); - } ArtifactList::const_iterator it = m_artifact->transformer->inputs.begin(); for (; it != m_artifact->transformer->inputs.end(); ++it) { @@ -358,6 +355,7 @@ void InputArtifactScanner::handleDependency(ResolvedDependency &dependency) if (insertIntoProduct && !product->buildData->artifacts.contains(artifactDependency)) insertArtifact(product, artifactDependency, m_logger); safeConnect(m_artifact, artifactDependency, m_logger); + m_artifact->childrenAddedByScanner += artifactDependency; m_newDependencyAdded = true; } } diff --git a/src/lib/buildgraph/projectbuilddata.cpp b/src/lib/buildgraph/projectbuilddata.cpp index 1e28a4afa..1ad45c13a 100644 --- a/src/lib/buildgraph/projectbuilddata.cpp +++ b/src/lib/buildgraph/projectbuilddata.cpp @@ -113,6 +113,7 @@ static void disconnectArtifactChildren(Artifact *artifact, const Logger &logger) foreach (Artifact * const child, artifact->children) child->parents.remove(artifact); artifact->children.clear(); + artifact->childrenAddedByScanner.clear(); } static void disconnectArtifactParents(Artifact *artifact, ProjectBuildData *projectBuildData, @@ -124,6 +125,7 @@ static void disconnectArtifactParents(Artifact *artifact, ProjectBuildData *proj } foreach (Artifact * const parent, artifact->parents) { parent->children.remove(artifact); + parent->childrenAddedByScanner.remove(artifact); if (parent->transformer) { parent->transformer->inputs.remove(artifact); projectBuildData->artifactsThatMustGetNewTransformers += parent; -- cgit v1.2.1