diff options
| -rw-r--r-- | src/lib/buildgraph/rulesapplicator.cpp | 7 | ||||
| -rw-r--r-- | src/lib/language/filetags.cpp | 11 | ||||
| -rw-r--r-- | src/lib/language/filetags.h | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/buildgraph/rulesapplicator.cpp b/src/lib/buildgraph/rulesapplicator.cpp index 388da361a..34fdae728 100644 --- a/src/lib/buildgraph/rulesapplicator.cpp +++ b/src/lib/buildgraph/rulesapplicator.cpp @@ -111,9 +111,7 @@ void RulesApplicator::doApply(const ArtifactList &inputArtifacts) foreach (Artifact *targetArtifact, dep->buildData->targetArtifacts) artifactsToCheck.unite(targetArtifact->transformer->outputs); foreach (Artifact *artifact, artifactsToCheck) { - FileTags matchingFileTags = artifact->fileTags; - matchingFileTags.intersect(usingsFileTags); - if (!matchingFileTags.isEmpty()) + if (artifact->fileTags.matches(usingsFileTags)) usingArtifacts.insert(artifact); } } @@ -279,8 +277,7 @@ Artifact *RulesApplicator::createOutputArtifact(const RuleArtifactConstPtr &rule for (int i = 0; i < m_product->artifactProperties.count(); ++i) { const ArtifactPropertiesConstPtr &props = m_product->artifactProperties.at(i); - FileTags filter = props->fileTagsFilter(); - if (!filter.intersect(outputArtifact->fileTags).isEmpty()) { + if (outputArtifact->fileTags.matches(props->fileTagsFilter())) { outputArtifact->properties = props->propertyMap(); break; } diff --git a/src/lib/language/filetags.cpp b/src/lib/language/filetags.cpp index c7c12b642..0a7b97ae4 100644 --- a/src/lib/language/filetags.cpp +++ b/src/lib/language/filetags.cpp @@ -54,6 +54,17 @@ FileTags FileTags::fromStringList(const QStringList &strings) return result; } +/*! + * \return \c{true} if this file tags set has file tags in common with \c{other}. + */ +bool FileTags::matches(const FileTags &other) const +{ + for (FileTags::const_iterator it = other.begin(); it != other.end(); ++it) + if (contains(*it)) + return true; + return false; +} + LogWriter operator <<(LogWriter w, const FileTags &tags) { bool firstLoop = true; diff --git a/src/lib/language/filetags.h b/src/lib/language/filetags.h index cebdc84b0..6f269548f 100644 --- a/src/lib/language/filetags.h +++ b/src/lib/language/filetags.h @@ -65,6 +65,7 @@ class FileTags : public QSet<FileTag> public: QStringList toStringList() const; static FileTags fromStringList(const QStringList &strings); + bool matches(const FileTags &other) const; }; LogWriter operator <<(LogWriter w, const FileTags &tags); |
