aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/buildgraph/rulegraph.h
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-02-10 18:08:01 +0100
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-02-13 15:33:27 +0100
commite73f60919079fc7cb0f0ad6d50b1a364c7b0d2a6 (patch)
tree3ce15f1f9b336063d591999ce325ce28a6e21320 /src/lib/corelib/buildgraph/rulegraph.h
parenta3634a6bbb193c47cdec887a6b29356c979961aa (diff)
support transformers with an unknown number of outputs
To support different types of nodes in the build graph, we introduce the base class BuildGraphNode. Artifact now derives from BuildGraphNode. A RuleNode class is introduced that represents a rule in the build graph. Rules are applied in the build phase and not in a pre-build phase anymore. The handling of moc has been revisited. The fixed automoc pre-build phase is no more. This is the squashed merge of a feature branch. Task-number: QBS-370 Change-Id: If27cdc51cba8c9542e4282c2caa456faa723aeff Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib/corelib/buildgraph/rulegraph.h')
-rw-r--r--src/lib/corelib/buildgraph/rulegraph.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/corelib/buildgraph/rulegraph.h b/src/lib/corelib/buildgraph/rulegraph.h
index 2f9a42a33..375224449 100644
--- a/src/lib/corelib/buildgraph/rulegraph.h
+++ b/src/lib/corelib/buildgraph/rulegraph.h
@@ -42,13 +42,20 @@
namespace qbs {
namespace Internal {
+class RuleGraphVisitor
+{
+public:
+ virtual void visit(const RuleConstPtr &parentRule, const RuleConstPtr &rule) = 0;
+ virtual void endVisit(const RuleConstPtr &rule) { Q_UNUSED(rule); }
+};
+
class RuleGraph
{
public:
RuleGraph();
void build(const QSet<RulePtr> &rules, const FileTags &productFileTag);
- QList<RuleConstPtr> topSorted();
+ void accept(RuleGraphVisitor *visitor) const;
void dump() const;
@@ -56,8 +63,8 @@ private:
void dump_impl(QByteArray &indent, int rootIndex) const;
int insert(const RulePtr &rule);
void connect(const Rule *creatingRule, const Rule *consumingRule);
- QList<RuleConstPtr> topSort(const RuleConstPtr &rule, QSet<const Rule *> *seenRules,
- QList<const Rule *> *rulePath);
+ void traverse(RuleGraphVisitor *visitor, const RuleConstPtr &parentRule,
+ const RuleConstPtr &rule) const;
private:
QMap<FileTag, QList<const Rule*> > m_outputFileTagToRule;