aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/productbuilddata.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-01-22 12:53:40 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-01-23 09:16:08 +0000
commitabff4b1b9b9b76e9b00b5a73108852e6f8e3e5d4 (patch)
treed18141f7ffd015fd45904700d19293d6c7b05050 /src/lib/corelib/buildgraph/productbuilddata.h
parent901bf1f7749e79a9fae2999d50131496dcaf4036 (diff)
Make ProductBuildData a proper class with accessors and modifiers
We will need to keep track of some mutating accesses in a follow-up change. Change-Id: I8b3c92f6cca0f5dceb35ef7559cc1357cdf38656 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/productbuilddata.h')
-rw-r--r--src/lib/corelib/buildgraph/productbuilddata.h53
1 files changed, 39 insertions, 14 deletions
diff --git a/src/lib/corelib/buildgraph/productbuilddata.h b/src/lib/corelib/buildgraph/productbuilddata.h
index 5347dca98..4158ea301 100644
--- a/src/lib/corelib/buildgraph/productbuilddata.h
+++ b/src/lib/corelib/buildgraph/productbuilddata.h
@@ -52,39 +52,64 @@ namespace Internal {
class Logger;
+using ArtifactSetByFileTag = QHash<FileTag, ArtifactSet>;
+
class QBS_AUTOTEST_EXPORT ProductBuildData
{
public:
~ProductBuildData();
const TypeFilter<Artifact> rootArtifacts() const;
- NodeSet nodes;
- NodeSet roots;
+ const NodeSet &allNodes() const { return m_nodes; }
+ const NodeSet &rootNodes() const { return m_roots; }
+
+ void addNode(BuildGraphNode *node) { m_nodes.insert(node); }
+ void addRootNode(BuildGraphNode *node) { m_roots.insert(node); }
+ void addArtifact(Artifact *artifact);
+ void addArtifactToSet(Artifact *artifact);
+ void removeArtifact(Artifact *artifact);
+ void removeArtifactFromSetByFileTag(Artifact *artifact, const FileTag &fileTag);
+ void addFileTagToArtifact(Artifact *artifact, const FileTag &tag);
+ void addArtifactWithChangedInputsForRule(const RuleConstPtr &rule, Artifact *artifact);
+ void removeArtifactWithChangedInputsForRule(const RuleConstPtr &rule, Artifact *artifact);
+ void removeAllArtifactsWithChangedInputsForRule(const RuleConstPtr &rule);
+ bool ruleHasArtifactWithChangedInputs(const RuleConstPtr &rule) const;
+
+ ArtifactSetByFileTag artifactsByFileTag() const { return m_artifactsByFileTag; }
+
+ AllRescuableArtifactData rescuableArtifactData() const { return m_rescuableArtifactData; }
+ void setRescuableArtifactData(const AllRescuableArtifactData &rad);
+ RescuableArtifactData removeFromRescuableArtifactData(const QString &filePath);
+ void addRescuableArtifactData(const QString &filePath, const RescuableArtifactData &rad);
+
+ unsigned int buildPriority() const { return m_buildPriority; }
+ void setBuildPriority(unsigned int prio) { m_buildPriority = prio; }
+
+ void load(PersistentPool &pool);
+ void store(PersistentPool &pool) const;
+
+private:
+ void removeArtifactFromSet(Artifact *artifact);
+
+ NodeSet m_nodes;
+ NodeSet m_roots;
// After change tracking, this is the relevant data of artifacts that were in the build data
// of the restored product, and will potentially be re-created by our rules.
// If and when that happens, the relevant data will be copied over to the newly created
// artifact.
- AllRescuableArtifactData rescuableArtifactData;
+ AllRescuableArtifactData m_rescuableArtifactData;
// Do not store, initialized in executor. Higher prioritized artifacts are built first.
- unsigned int buildPriority;
+ unsigned int m_buildPriority;
- typedef QHash<FileTag, ArtifactSet> ArtifactSetByFileTag;
- ArtifactSetByFileTag artifactsByFileTag;
+ ArtifactSetByFileTag m_artifactsByFileTag;
typedef QHash<RuleConstPtr, ArtifactSet> ArtifactSetByRule;
- ArtifactSetByRule artifactsWithChangedInputsPerRule;
+ ArtifactSetByRule m_artifactsWithChangedInputsPerRule;
- void load(PersistentPool &pool);
- void store(PersistentPool &pool) const;
};
-void addArtifactToSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag &container);
-void removeArtifactFromSetByFileTag(Artifact *artifact, const FileTag &fileTag,
- ProductBuildData::ArtifactSetByFileTag &container);
-void removeArtifactFromSet(Artifact *artifact, ProductBuildData::ArtifactSetByFileTag &container);
-
} // namespace Internal
} // namespace qbs