diff options
Diffstat (limited to 'src/graph.h')
-rw-r--r-- | src/graph.h | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/graph.h b/src/graph.h index 5b6bdf2..079db43 100644 --- a/src/graph.h +++ b/src/graph.h @@ -57,21 +57,6 @@ struct FileStat { Node* node_; }; -struct Edge; - -/// Information about a node in the dependency graph: the file, whether -/// it's dirty, etc. -struct Node { - Node(FileStat* file) : file_(file), dirty_(false), in_edge_(NULL) {} - - bool dirty() const { return dirty_; } - - FileStat* file_; - bool dirty_; - Edge* in_edge_; - vector<Edge*> out_edges_; -}; - /// An invokable build command and associated metadata (description, etc.). struct Rule { Rule(const string& name) : name_(name), generator_(false) { } @@ -86,13 +71,18 @@ struct Rule { bool generator_; }; +struct BuildLog; +struct Node; struct State; /// An edge in the dependency graph; links between Nodes using Rules. struct Edge { - Edge() : rule_(NULL), env_(NULL), implicit_deps_(0), order_only_deps_(0) {} + Edge() : rule_(NULL), env_(NULL), outputs_ready_(false), implicit_deps_(0), + order_only_deps_(0) {} bool RecomputeDirty(State* state, DiskInterface* disk_interface, string* err); + void RecomputeOutputDirty(BuildLog* build_log, time_t most_recent_input, + bool dirty, const string& command, Node* output); string EvaluateCommand(); // XXX move to env, take env ptr string GetDescription(); bool LoadDepFile(State* state, DiskInterface* disk_interface, string* err); @@ -103,6 +93,9 @@ struct Edge { vector<Node*> inputs_; vector<Node*> outputs_; Env* env_; + bool outputs_ready_; + + bool outputs_ready() const { return outputs_ready_; } // XXX There are three types of inputs. // 1) explicit deps, which show up as $in on the command line; @@ -128,4 +121,18 @@ struct Edge { bool is_phony() const; }; +/// Information about a node in the dependency graph: the file, whether +/// it's dirty, etc. +struct Node { + Node(FileStat* file) : file_(file), dirty_(false), in_edge_(NULL) {} + + bool dirty() const { return dirty_; } + bool ready() const { return !in_edge_ || in_edge_->outputs_ready(); } + + FileStat* file_; + bool dirty_; + Edge* in_edge_; + vector<Edge*> out_edges_; +}; + #endif // NINJA_GRAPH_H_ |