15 #ifndef NINJA_GRAPH_H_ 16 #define NINJA_GRAPH_H_ 40 slash_bits_(slash_bits),
53 return Stat(disk_interface, err);
75 const string&
path()
const {
return path_; }
78 return PathDecanonicalized(path_, slash_bits_);
80 static string PathDecanonicalized(
const string& path,
86 bool dirty()
const {
return dirty_; }
93 int id()
const {
return id_; }
96 const vector<Edge*>&
out_edges()
const {
return out_edges_; }
99 void Dump(
const char* prefix=
"")
const;
138 Edge() : rule_(NULL), pool_(NULL), env_(NULL), mark_(VisitNone),
139 outputs_ready_(false), deps_missing_(false),
140 implicit_deps_(0), order_only_deps_(0), implicit_outs_(0) {}
143 bool AllInputsReady()
const;
148 string EvaluateCommand(
bool incl_rsp_file =
false);
151 string GetBinding(
const string& key);
152 bool GetBindingBool(
const string& key);
155 string GetUnescapedDepfile();
157 string GetUnescapedRspfile();
159 void Dump(
const char* prefix=
"")
const;
186 return index >= inputs_.size() - order_only_deps_ - implicit_deps_ &&
187 !is_order_only(index);
190 return index >= inputs_.size() - order_only_deps_;
200 return index >= outputs_.size() - implicit_outs_;
203 bool is_phony()
const;
204 bool use_console()
const;
205 bool maybe_phonycycle_diagnostic()
const;
215 : state_(state), disk_interface_(disk_interface), deps_log_(deps_log),
216 depfile_parser_options_(depfile_parser_options) {}
221 bool LoadDeps(
Edge* edge,
string* err);
230 bool LoadDepFile(
Edge* edge,
const string& path,
string* err);
234 bool LoadDepsFromLog(
Edge* edge,
string* err);
238 vector<Node*>::iterator PreallocateSpace(
Edge* edge,
int count);
243 void CreatePhonyInEdge(
Node* node);
258 : build_log_(build_log),
259 disk_interface_(disk_interface),
260 dep_loader_(state, deps_log, disk_interface, depfile_parser_options) {}
267 bool RecomputeDirty(
Node* node,
string* err);
271 bool RecomputeOutputsDirty(
Edge* edge,
Node* most_recent_input,
272 bool* dirty,
string* err);
282 return dep_loader_.deps_log();
286 bool RecomputeDirty(
Node* node, vector<Node*>* stack,
string* err);
287 bool VerifyDAG(
Node* node, vector<Node*>* stack,
string* err);
291 bool RecomputeOutputDirty(
Edge* edge,
Node* most_recent_input,
292 const string& command,
Node* output);
299 #endif // NINJA_GRAPH_H_
const vector< Edge * > & out_edges() const
DepsLog * deps_log() const
const string & path() const
DepfileParserOptions const * depfile_parser_options_
void set_dirty(bool dirty)
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
bool outputs_ready() const
ImplicitDepLoader dep_loader_
Interface for accessing the disk.
uint64_t slash_bits() const
bool is_implicit_out(size_t index) const
void AddOutEdge(Edge *edge)
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)
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)
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.
Node(const string &path, uint64_t slash_bits)
uint64_t slash_bits_
Set bits starting from lowest for backslashes that were normalized to forward slashes by Canonicalize...
string PathDecanonicalized() const
Get |path()| but use slash_bits to convert back to original slash styles.
ImplicitDepLoader(State *state, DepsLog *deps_log, DiskInterface *disk_interface, DepfileParserOptions const *depfile_parser_options)
DepsLog * deps_log() const
BuildLog * build_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...
bool status_known() const
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...
const Rule & rule() const
Global state (file status) for a single run.
void set_in_edge(Edge *edge)
unsigned long long uint64_t
DiskInterface * disk_interface_
DependencyScan(State *state, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface, DepfileParserOptions const *depfile_parser_options)
bool StatIfNecessary(DiskInterface *disk_interface, string *err)
Return false on error.
vector< Node * > outputs_