42 DelayedEdges::iterator it =
delayed_.begin();
47 ready_queue->insert(edge);
56 for (DelayedEdges::const_iterator it =
delayed_.begin();
68 return ((weight_diff < 0) || (weight_diff == 0 && a < b));
87 map<string, const Rule*>::iterator i =
rules_.find(rule_name);
99 map<string, Pool*>::iterator i =
pools_.find(pool_name);
125 Paths::const_iterator i =
paths_.find(path);
132 const bool kAllowReplacements =
true;
133 const int kMaxValidEditDistance = 3;
135 int min_distance = kMaxValidEditDistance + 1;
137 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
139 i->first, path, kAllowReplacements, kMaxValidEditDistance);
140 if (distance < min_distance && i->second) {
141 min_distance = distance;
158 Warning(
"multiple rules generate %s. "
159 "builds involving this target will not be correct; "
169 *err =
"unknown target '" + path.
AsString() +
"'";
177 vector<Node*> root_nodes;
179 for (vector<Edge*>::iterator e =
edges_.begin(); e !=
edges_.end(); ++e) {
180 for (vector<Node*>::iterator out = (*e)->outputs_.begin();
181 out != (*e)->outputs_.end(); ++out) {
182 if ((*out)->out_edges().empty())
183 root_nodes.push_back(*out);
187 if (!
edges_.empty() && root_nodes.empty())
188 *err =
"could not determine root nodes of build graph";
190 assert(
edges_.empty() || !root_nodes.empty());
199 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i)
200 i->second->ResetState();
201 for (vector<Edge*>::iterator e =
edges_.begin(); e !=
edges_.end(); ++e)
202 (*e)->outputs_ready_ =
false;
206 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
207 Node* node = i->second;
208 printf(
"%s %s [id:%d]\n",
209 node->
path().c_str(),
215 printf(
"resource_pools:\n");
216 for (map<string, Pool*>::const_iterator it =
pools_.begin();
219 if (!it->second->name().empty()) {
void AddIn(Edge *edge, StringPiece path)
vector< Edge * > edges_
All the edges of the graph.
void EdgeScheduled(const Edge &edge)
informs this Pool that the given edge is committed to be run.
Node * GetNode(StringPiece path)
Pool * LookupPool(const string &pool_name)
StringPiece represents a slice of a string whose memory is managed externally.
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
Node * SpellcheckNode(const string &path)
vector< Node * > defaults_
string AsString() const
Convert the slice into a full-fledged std::string, copying the data into a new string.
void AddOutEdge(Edge *edge)
An edge in the dependency graph; links between Nodes using Rules.
Edge * AddEdge(const Rule *rule)
void AddOut(Edge *edge, StringPiece path)
vector< Node * > DefaultNodes(string *error)
void Dump()
Dump the nodes and Pools (useful for debugging).
void AddRule(const Rule *rule)
An invokable build command and associated metadata (description, etc.).
bool status_known() const
void DelayEdge(Edge *edge)
adds the given edge to this Pool to be delayed.
A pool for delayed edges.
vector< Node * > RootNodes(string *error)
#define METRIC_RECORD(name)
The primary interface to metrics.
const string & name() const
const string & path() const
void RetrieveReadyEdges(set< Edge * > *ready_queue)
Pool will add zero or more edges to the ready_queue.
bool AddDefault(StringPiece path, string *error)
static bool WeightedEdgeCmp(const Edge *a, const Edge *b)
void EdgeFinished(const Edge &edge)
informs this Pool that the given edge is no longer runnable, and should relinquish its resources back...
void set_in_edge(Edge *edge)
const string & name() const
void Dump() const
Dump the Pool and its edges (useful for debugging).
map< string, Pool * > pools_
All the pools used in the graph.
void Warning(const char *msg,...)
Log a warning message.
int EditDistance(const StringPiece &s1, const StringPiece &s2, bool allow_replacements, int max_edit_distance)
map< string, const Rule * > rules_
All the rules used in the graph.
const Rule * LookupRule(const string &rule_name)
int current_use_
|current_use_| is the total of the weights of the edges which are currently scheduled in the Plan (i...
static const Rule kPhonyRule
Node * LookupNode(StringPiece path) const
vector< Node * > outputs_