diff options
| author | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-03-28 12:39:53 +0100 |
|---|---|---|
| committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-04-03 17:06:43 +0200 |
| commit | 12721ac8f2c34ff8d8c6bfd23c7b979c14fdbf13 (patch) | |
| tree | 3195957cb4aff42cae67a09b03f7ed23c02e1971 | |
| parent | 9f71bd40503001cb593ec113d16f9212263d4723 (diff) | |
| download | qbs-12721ac8f2c34ff8d8c6bfd23c7b979c14fdbf13.tar.gz | |
add convenience functions for artifact lookup
This makes it a bit easier to find the same artifact in two build graphs.
Change-Id: I758e6e14a9a2d6c26232361cef1b726369f328e3
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
| -rw-r--r-- | src/lib/buildgraph/buildproduct.cpp | 5 | ||||
| -rw-r--r-- | src/lib/buildgraph/buildproduct.h | 1 | ||||
| -rw-r--r-- | src/lib/buildgraph/buildproject.cpp | 9 | ||||
| -rw-r--r-- | src/lib/buildgraph/buildproject.h | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/buildgraph/buildproduct.cpp b/src/lib/buildgraph/buildproduct.cpp index 96a279035..a990d9547 100644 --- a/src/lib/buildgraph/buildproduct.cpp +++ b/src/lib/buildgraph/buildproduct.cpp @@ -112,6 +112,11 @@ Artifact *BuildProduct::lookupArtifact(const QString &filePath) const return lookupArtifact(dirPath, fileName); } +Artifact *BuildProduct::lookupArtifact(const Artifact *artifact) const +{ + return lookupArtifact(artifact->dirPath(), artifact->fileName()); +} + Artifact *BuildProduct::createArtifact(const SourceArtifactConstPtr &sourceArtifact, const Logger &logger) { diff --git a/src/lib/buildgraph/buildproduct.h b/src/lib/buildgraph/buildproduct.h index 5106fa9e8..ff9e59849 100644 --- a/src/lib/buildgraph/buildproduct.h +++ b/src/lib/buildgraph/buildproduct.h @@ -54,6 +54,7 @@ public: const QList<RuleConstPtr> &topSortedRules() const; Artifact *lookupArtifact(const QString &dirPath, const QString &fileName) const; Artifact *lookupArtifact(const QString &filePath) const; + Artifact *lookupArtifact(const Artifact *artifact) const; Artifact *createArtifact(const SourceArtifactConstPtr &sourceArtifact, const Logger &logger); void insertArtifact(Artifact *n, const Logger &logger); diff --git a/src/lib/buildgraph/buildproject.cpp b/src/lib/buildgraph/buildproject.cpp index 3db99b9cf..1027d4326 100644 --- a/src/lib/buildgraph/buildproject.cpp +++ b/src/lib/buildgraph/buildproject.cpp @@ -133,6 +133,11 @@ QList<Artifact *> BuildProject::lookupArtifacts(const QString &dirPath, const QS return result; } +QList<Artifact *> BuildProject::lookupArtifacts(const Artifact *artifact) const +{ + return lookupArtifacts(artifact->dirPath(), artifact->fileName()); +} + void BuildProject::insertFileDependency(Artifact *artifact) { QBS_CHECK(artifact->artifactType == Artifact::FileDependency); @@ -165,7 +170,7 @@ void BuildProject::rescueDependencies(const BuildProjectPtr &other) .arg(artifact->fileName()); } - Artifact *otherArtifact = otherProduct->lookupArtifact(artifact->dirPath(), artifact->fileName()); + Artifact *otherArtifact = otherProduct->lookupArtifact(artifact); if (!otherArtifact || !otherArtifact->transformer) continue; @@ -174,7 +179,7 @@ void BuildProject::rescueDependencies(const BuildProjectPtr &other) if (otherArtifact->transformer->inputs.contains(otherChild)) continue; - QList<Artifact *> children = lookupArtifacts(otherChild->dirPath(), otherChild->fileName()); + QList<Artifact *> children = lookupArtifacts(otherChild); foreach (Artifact *child, children) { if (!artifact->children.contains(child)) safeConnect(artifact, child, m_logger); diff --git a/src/lib/buildgraph/buildproject.h b/src/lib/buildgraph/buildproject.h index 7cf949451..37610b6d5 100644 --- a/src/lib/buildgraph/buildproject.h +++ b/src/lib/buildgraph/buildproject.h @@ -74,6 +74,7 @@ public: void removeFromArtifactLookupTable(Artifact *artifact); QList<Artifact *> lookupArtifacts(const QString &filePath) const; QList<Artifact *> lookupArtifacts(const QString &dirPath, const QString &fileName) const; + QList<Artifact *> lookupArtifacts(const Artifact *artifact) const; void insertFileDependency(Artifact *artifact); void rescueDependencies(const BuildProjectPtr &other); void removeArtifact(Artifact *artifact); |
