15 #ifndef NINJA_GRAPH_H_
16 #define NINJA_GRAPH_H_
36 explicit Node(
const string& path)
73 const string&
path()
const {
return path_; }
76 bool dirty()
const {
return dirty_; }
83 int id()
const {
return id_; }
86 const vector<Edge*>&
out_edges()
const {
return out_edges_; }
89 void Dump(
const char* prefix=
"")
const;
117 explicit Rule(
const string& name) : name_(name) {}
119 const string&
name()
const {
return name_; }
122 void AddBinding(
const string& key,
const EvalString& val);
124 static bool IsReservedBinding(
const string& var);
126 const EvalString* GetBinding(
const string& key)
const;
138 Edge() : rule_(NULL), env_(NULL), outputs_ready_(false), implicit_deps_(0),
139 order_only_deps_(0) {}
142 bool AllInputsReady()
const;
147 string EvaluateCommand(
bool incl_rsp_file =
false);
149 string GetBinding(
const string& key);
150 bool GetBindingBool(
const string& key);
152 void Dump(
const char* prefix=
"")
const;
177 return index >= inputs_.size() - order_only_deps_ - implicit_deps_ &&
178 !is_order_only(index);
181 return index >= inputs_.size() - order_only_deps_;
184 bool is_phony()
const;
193 : state_(state), disk_interface_(disk_interface), deps_log_(deps_log) {}
207 bool LoadDepFile(
Edge* edge,
const string& path,
string* err);
211 bool LoadDepsFromLog(
Edge* edge,
TimeStamp* mtime,
string* err);
215 vector<Node*>::iterator PreallocateSpace(
Edge* edge,
int count);
220 void CreatePhonyInEdge(
Node* node);
233 : build_log_(build_log),
234 disk_interface_(disk_interface),
235 dep_loader_(state, deps_log, disk_interface) {}
241 bool RecomputeDirty(
Edge* edge,
string* err);
245 bool RecomputeOutputDirty(
Edge* edge,
Node* most_recent_input,
247 const string& command,
Node* output);
257 return dep_loader_.deps_log();
266 #endif // NINJA_GRAPH_H_
void set_dirty(bool dirty)
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
bool StatIfNecessary(DiskInterface *disk_interface)
Return true if we needed to stat.
ImplicitDepLoader dep_loader_
Interface for accessing the disk.
void AddOutEdge(Edge *edge)
bool outputs_ready() const
An edge in the dependency graph; links between Nodes using Rules.
Edge * in_edge_
The Edge that produces this Node, or NULL when there is no known edge to produce it.
Store a log of every command ran for every build.
bool is_order_only(size_t index)
ImplicitDepLoader(State *state, DepsLog *deps_log, DiskInterface *disk_interface)
vector< Edge * > out_edges_
All Edges that use this Node as an input.
As build commands run they can output extra dependency information (e.g.
An Env which contains a mapping of variables to values as well as a pointer to a parent scope...
bool is_implicit(size_t index)
BuildLog * build_log() const
DiskInterface * disk_interface_
An invokable build command and associated metadata (description, etc.).
void ResetState()
Mark as not-yet-stat()ed and not dirty.
void MarkMissing()
Mark the Node as already-stat()ed and missing.
bool status_known() const
DepsLog * deps_log() const
A pool for delayed edges.
void set_build_log(BuildLog *log)
TimeStamp mtime_
Possible values of mtime_: -1: file hasn't been examined 0: we looked, and file doesn't exist >0: act...
const string & path() const
DependencyScan(State *state, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface)
map< string, EvalString > Bindings
bool dirty_
Dirty is true when the underlying file is out-of-date.
int id_
A dense integer id for the node, assigned and used by DepsLog.
DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_re...
ImplicitDepLoader loads implicit dependencies, as referenced via the "depfile" attribute in build fil...
Global state (file status, loaded rules) for a single run.
map< string, EvalString > bindings_
void set_in_edge(Edge *edge)
const string & name() const
DiskInterface * disk_interface_
const Rule & rule() const
A tokenized string that contains variable references.
const vector< Edge * > & out_edges() const
DepsLog * deps_log() const
vector< Node * > outputs_