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));
85 map<string, const Rule*>::iterator i =
rules_.find(rule_name);
97 map<string, Pool*>::iterator i =
pools_.find(pool_name);
123 Paths::iterator i =
paths_.find(path);
130 const bool kAllowReplacements =
true;
131 const int kMaxValidEditDistance = 3;
133 int min_distance = kMaxValidEditDistance + 1;
135 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
137 i->first, path, kAllowReplacements, kMaxValidEditDistance);
138 if (distance < min_distance && i->second) {
139 min_distance = distance;
156 Warning(
"multiple rules generate %s. "
157 "builds involving this target will not be correct; "
167 *err =
"unknown target '" + path.
AsString() +
"'";
175 vector<Node*> root_nodes;
177 for (vector<Edge*>::iterator e =
edges_.begin(); e !=
edges_.end(); ++e) {
178 for (vector<Node*>::iterator out = (*e)->outputs_.begin();
179 out != (*e)->outputs_.end(); ++out) {
180 if ((*out)->out_edges().empty())
181 root_nodes.push_back(*out);
185 if (!
edges_.empty() && root_nodes.empty())
186 *err =
"could not determine root nodes of build graph";
188 assert(
edges_.empty() || !root_nodes.empty());
197 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i)
198 i->second->ResetState();
199 for (vector<Edge*>::iterator e =
edges_.begin(); e !=
edges_.end(); ++e)
200 (*e)->outputs_ready_ =
false;
204 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
205 Node* node = i->second;
206 printf(
"%s %s [id:%d]\n",
207 node->
path().c_str(),
213 printf(
"resource_pools:\n");
214 for (map<string, Pool*>::const_iterator it =
pools_.begin();
217 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.
Node * LookupNode(StringPiece path)
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
vector< Node * > outputs_