15 #ifndef NINJA_GRAPH_H_
16 #define NINJA_GRAPH_H_
56 return Stat(disk_interface, err);
119 void Dump(
const char* prefix=
"")
const;
193 std::string
GetBinding(
const std::string& key)
const;
203 void Dump(
const char* prefix=
"")
const;
307 std::vector<StringPiece>* depfile_ins,
312 bool LoadDepFile(
Edge* edge,
const std::string& path, std::string* err);
349 bool RecomputeDirty(
Node* node, std::vector<Node*>* validation_nodes, std::string* err);
354 bool* dirty, std::string* err);
376 std::vector<Node*>* validation_nodes, std::string* err);
377 bool VerifyDAG(
Node* node, std::vector<Node*>* stack, std::string* err);
382 const std::string& command,
Node* output);
422 public std::priority_queue<Edge*, std::vector<Edge*>, EdgePriorityLess>{
std::set< Edge *, EdgeCmp > EdgeSet
An Env which contains a mapping of variables to values as well as a pointer to a parent scope.
Store a log of every command ran for every build.
DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_re...
bool RecomputeOutputDirty(const Edge *edge, const Node *most_recent_input, const std::string &command, Node *output)
Recompute whether a given single output should be marked dirty.
void set_build_log(BuildLog *log)
bool RecomputeNodeDirty(Node *node, std::vector< Node * > *stack, std::vector< Node * > *validation_nodes, std::string *err)
BuildLog * build_log() const
void RecordExplanation(const Node *node, const char *fmt,...)
bool VerifyDAG(Node *node, std::vector< Node * > *stack, std::string *err)
bool RecomputeOutputsDirty(Edge *edge, Node *most_recent_input, bool *dirty, std::string *err)
Recompute whether any output of the edge is dirty, if so sets |*dirty|.
DiskInterface * disk_interface_
DepsLog * deps_log() const
bool LoadDyndeps(Node *node, std::string *err) const
Load a dyndep file from the given node's path and update the build graph with the new information.
bool LoadDyndeps(Node *node, DyndepFile *ddf, std::string *err) const
OptionalExplanations explanations_
DyndepLoader dyndep_loader_
DependencyScan(State *state, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface, DepfileParserOptions const *depfile_parser_options, Explanations *explanations)
ImplicitDepLoader dep_loader_
bool RecomputeDirty(Node *node, std::vector< Node * > *validation_nodes, std::string *err)
Update the |dirty_| state of the given nodes by transitively inspecting their input edges.
As build commands run they can output extra dependency information (e.g.
Interface for accessing the disk.
Store data loaded from one dyndep file.
DyndepLoader loads dynamically discovered dependencies, as referenced via the "dyndep" attribute in b...
bool operator()(const Edge *a, const Edge *b) const
bool operator()(const Edge *e1, const Edge *e2) const
bool operator()(const Edge *e1, const Edge *e2) const
An edge in the dependency graph; links between Nodes using Rules.
int64_t prev_elapsed_time_millis
std::string GetBinding(const std::string &key) const
Returns the shell-escaped value of |key|.
bool generated_by_dep_loader_
bool maybe_phonycycle_diagnostic() const
int64_t critical_path_weight() const
std::string GetUnescapedDyndep() const
Like GetBinding("dyndep"), but without shell escaping.
std::vector< Node * > outputs_
Jobserver::Slot job_slot_
A Jobserver slot instance. Invalid by default.
bool outputs_ready() const
bool is_order_only(size_t index)
void set_critical_path_weight(int64_t critical_path_weight)
bool GetBindingBool(const std::string &key) const
bool is_implicit(size_t index)
TimeStamp command_start_time_
bool is_implicit_out(size_t index) const
std::string EvaluateCommand(bool incl_rsp_file=false) const
Expand all variables in a command and return it as a string.
void Dump(const char *prefix="") const
int64_t critical_path_weight_
const Rule & rule() const
std::vector< Node * > validations_
std::vector< Node * > inputs_
std::string GetUnescapedRspfile() const
Like GetBinding("rspfile"), but without shell escaping.
std::string GetUnescapedDepfile() const
Like GetBinding("depfile"), but without shell escaping.
bool AllInputsReady() const
Return true if all inputs' in-edges are ready.
A class used to record a list of explanation strings associated with a given 'item' pointer.
ImplicitDepLoader loads implicit dependencies, as referenced via the "depfile" attribute in build fil...
bool LoadDepFile(Edge *edge, const std::string &path, std::string *err)
Load implicit dependencies for edge from a depfile attribute.
std::vector< Node * >::iterator PreallocateSpace(Edge *edge, int count)
Preallocate count spaces in the input array on edge, returning an iterator pointing at the first new ...
virtual bool ProcessDepfileDeps(Edge *edge, std::vector< StringPiece > *depfile_ins, std::string *err)
Process loaded implicit dependencies for edge and update the graph.
bool LoadDeps(Edge *edge, std::string *err)
Load implicit dependencies for edge.
bool LoadDepsFromLog(Edge *edge, std::string *err)
Load implicit dependencies for edge from the DepsLog.
DepsLog * deps_log() const
ImplicitDepLoader(State *state, DepsLog *deps_log, DiskInterface *disk_interface, DepfileParserOptions const *depfile_parser_options, Explanations *explanations)
DiskInterface * disk_interface_
OptionalExplanations explanations_
DepfileParserOptions const * depfile_parser_options_
A Jobserver::Slot models a single job slot that can be acquired from.
Information about a node in the dependency graph: the file, whether it's dirty, mtime,...
void set_dirty(bool dirty)
void set_in_edge(Edge *edge)
const std::vector< Edge * > & validation_out_edges() const
void UpdatePhonyMtime(TimeStamp mtime)
If the file doesn't exist, set the mtime_ from its dependencies.
void AddValidationOutEdge(Edge *edge)
void Dump(const char *prefix="") const
void set_dyndep_pending(bool pending)
TimeStamp mtime_
Possible values of mtime_: -1: file hasn't been examined 0: we looked, and file doesn't exist >0: act...
bool generated_by_dep_loader() const
Indicates whether this node was generated from a depfile or dyndep file, instead of being a regular i...
bool dyndep_pending_
Store whether dyndep information is expected from this node but has not yet been loaded.
std::vector< Edge * > validation_out_edges_
All Edges that use this Node as a validation.
Node(const std::string &path, uint64_t slash_bits)
@ ExistenceStatusMissing
The file doesn't exist. mtime_ will be the latest mtime of its dependencies.
@ ExistenceStatusExists
The path is an actual file. mtime_ will be the file's mtime.
@ ExistenceStatusUnknown
The file hasn't been examined.
void AddOutEdge(Edge *edge)
static std::string PathDecanonicalized(const std::string &path, uint64_t slash_bits)
const std::string & path() const
uint64_t slash_bits_
Set bits starting from lowest for backslashes that were normalized to forward slashes by Canonicalize...
bool status_known() const
bool dyndep_pending() const
void ResetState()
Mark as not-yet-stat()ed and not dirty.
std::vector< Edge * > out_edges_
All Edges that use this Node as an input.
void set_generated_by_dep_loader(bool value)
std::string PathDecanonicalized() const
Get |path()| but use slash_bits to convert back to original slash styles.
bool StatIfNecessary(DiskInterface *disk_interface, std::string *err)
Return false on error.
void MarkMissing()
Mark the Node as already-stat()ed and missing.
bool dirty_
Dirty is true when the underlying file is out-of-date.
Edge * in_edge_
The Edge that produces this Node, or NULL when there is no known edge to produce it.
bool Stat(DiskInterface *disk_interface, std::string *err)
Return false on error.
uint64_t slash_bits() const
bool generated_by_dep_loader_
Set to true when this node comes from a depfile, a dyndep file or the deps log.
const std::vector< Edge * > & out_edges() const
int id_
A dense integer id for the node, assigned and used by DepsLog.
Convenience wrapper for an Explanations pointer, which can be null if no explanations need to be reco...
A pool for delayed edges.
An invocable build command and associated metadata (description, etc.).
Global state (file status) for a single run.
unsigned long long uint64_t
signed long long int64_t
A 64-bit integer type.