42 DelayedEdges::iterator it =
delayed_.begin();
47 ready_queue->push(edge);
56 for (DelayedEdges::const_iterator it =
delayed_.begin();
79 map<string, Pool*>::iterator i =
pools_.find(pool_name);
105 Paths::const_iterator i =
paths_.find(path);
112 const bool kAllowReplacements =
true;
113 const int kMaxValidEditDistance = 3;
115 int min_distance = kMaxValidEditDistance + 1;
117 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
119 i->first, path, kAllowReplacements, kMaxValidEditDistance);
120 if (distance < min_distance && i->second) {
121 min_distance = distance;
140 *err = path.
AsString() +
" is defined as an output multiple times";
142 *err =
"multiple rules generate " + path.
AsString();
162 *err =
"unknown target '" + path.
AsString() +
"'";
170 vector<Node*> root_nodes;
172 for (vector<Edge*>::const_iterator e =
edges_.begin();
174 for (vector<Node*>::const_iterator out = (*e)->outputs_.begin();
175 out != (*e)->outputs_.end(); ++out) {
176 if ((*out)->out_edges().empty())
177 root_nodes.push_back(*out);
181 if (!
edges_.empty() && root_nodes.empty())
182 *err =
"could not determine root nodes of build graph";
192 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i)
193 i->second->ResetState();
194 for (vector<Edge*>::iterator e =
edges_.begin(); e !=
edges_.end(); ++e) {
195 (*e)->outputs_ready_ =
false;
196 (*e)->deps_loaded_ =
false;
202 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
203 Node* node = i->second;
204 printf(
"%s %s [id:%d]\n",
205 node->
path().c_str(),
211 printf(
"resource_pools:\n");
212 for (map<string, Pool*>::const_iterator it =
pools_.begin();
215 if (!it->second->name().empty()) {
int EditDistance(const StringPiece &s1, const StringPiece &s2, bool allow_replacements, int max_edit_distance)
An edge in the dependency graph; links between Nodes using Rules.
std::vector< Node * > outputs_
std::vector< Node * > validations_
std::vector< Node * > inputs_
Information about a node in the dependency graph: the file, whether it's dirty, mtime,...
const std::string & path() const
void set_in_edge(Edge *edge)
void AddValidationOutEdge(Edge *edge)
void AddOutEdge(Edge *edge)
bool status_known() const
void set_generated_by_dep_loader(bool value)
A pool for delayed edges.
void DelayEdge(Edge *edge)
adds the given edge to this Pool to be delayed.
void RetrieveReadyEdges(EdgePriorityQueue *ready_queue)
Pool will add zero or more edges to the ready_queue.
void EdgeScheduled(const Edge &edge)
informs this Pool that the given edge is committed to be run.
const std::string & name() const
void EdgeFinished(const Edge &edge)
informs this Pool that the given edge is no longer runnable, and should relinquish its resources back...
int current_use_
|current_use_| is the total of the weights of the edges which are currently scheduled in the Plan (i....
void Dump() const
Dump the Pool and its edges (useful for debugging).
An invocable build command and associated metadata (description, etc.).
static std::unique_ptr< Rule > Phony()
std::vector< Node * > RootNodes(std::string *error) const
void AddValidation(Edge *edge, StringPiece path, uint64_t slash_bits)
std::vector< Edge * > edges_
All the edges of the graph.
std::vector< Node * > DefaultNodes(std::string *error) const
bool AddDefault(StringPiece path, std::string *error)
Edge * AddEdge(const Rule *rule)
Node * SpellcheckNode(const std::string &path)
Node * GetNode(StringPiece path, uint64_t slash_bits)
void AddIn(Edge *edge, StringPiece path, uint64_t slash_bits)
Add input / output / validation nodes to a given edge.
Node * LookupNode(StringPiece path) const
std::map< std::string, Pool * > pools_
All the pools used in the graph.
Pool * LookupPool(const std::string &pool_name)
std::vector< Node * > defaults_
void Dump()
Dump the nodes and Pools (useful for debugging).
bool AddOut(Edge *edge, StringPiece path, uint64_t slash_bits, std::string *err)
StringPiece represents a slice of a string whose memory is managed externally.
std::string AsString() const
Convert the slice into a full-fledged std::string, copying the data into a new string.
unsigned long long uint64_t