summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/artifact.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/buildgraph/artifact.cpp')
-rw-r--r--src/lib/buildgraph/artifact.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/lib/buildgraph/artifact.cpp b/src/lib/buildgraph/artifact.cpp
index 01bad8e36..da6a77ebc 100644
--- a/src/lib/buildgraph/artifact.cpp
+++ b/src/lib/buildgraph/artifact.cpp
@@ -30,7 +30,7 @@
#include "artifact.h"
#include "transformer.h"
-
+#include "buildgraphvisitor.h"
#include <language/propertymapinternal.h>
#include <tools/fileinfo.h>
#include <tools/persistence.h>
@@ -64,6 +64,17 @@ Artifact::~Artifact()
{
}
+void Artifact::accept(BuildGraphVisitor *visitor)
+{
+ if (visitor->visit(this))
+ acceptChildren(visitor);
+}
+
+QString Artifact::toString() const
+{
+ return QLatin1String("ARTIFACT ") + filePath();
+}
+
void Artifact::initialize()
{
artifactType = Unknown;
@@ -73,13 +84,24 @@ void Artifact::initialize()
alwaysUpdated = true;
}
+ArtifactSet Artifact::parentArtifacts() const
+{
+ return ArtifactSet::fromNodeSet(parents);
+}
+
+ArtifactSet Artifact::childArtifacts() const
+{
+ return ArtifactSet::fromNodeSet(children);
+}
+
void Artifact::load(PersistentPool &pool)
{
FileResourceBase::load(pool);
- pool.loadContainer(children);
+ BuildGraphNode::load(pool);
+ children.load(pool);
// restore parents of the loaded children
- for (ArtifactList::const_iterator it = children.constBegin(); it != children.constEnd(); ++it)
+ for (NodeSet::const_iterator it = children.constBegin(); it != children.constEnd(); ++it)
(*it)->parents.insert(this);
pool.loadContainer(childrenAddedByScanner);
@@ -90,7 +112,6 @@ void Artifact::load(PersistentPool &pool)
pool.stream()
>> fileTags
>> artifactType
- >> autoMocTimestamp
>> c;
alwaysUpdated = c;
}
@@ -98,8 +119,9 @@ void Artifact::load(PersistentPool &pool)
void Artifact::store(PersistentPool &pool) const
{
FileResourceBase::store(pool);
+ BuildGraphNode::store(pool);
// Do not store parents to avoid recursion.
- pool.storeContainer(children);
+ children.store(pool);
pool.storeContainer(childrenAddedByScanner);
pool.storeContainer(fileDependencies);
pool.store(properties);
@@ -107,7 +129,6 @@ void Artifact::store(PersistentPool &pool) const
pool.stream()
<< fileTags
<< artifactType
- << autoMocTimestamp
<< static_cast<unsigned char>(alwaysUpdated);
}