42 DelayedEdges::iterator it =
delayed_.begin();
47 ready_queue->insert(edge);
56 for (DelayedEdges::const_iterator it =
delayed_.begin();
69 return ((weight_diff < 0) || (weight_diff == 0 && a < b));
88 map<string, Pool*>::iterator i =
pools_.find(pool_name);
114 Paths::const_iterator i =
paths_.find(path);
121 const bool kAllowReplacements =
true;
122 const int kMaxValidEditDistance = 3;
124 int min_distance = kMaxValidEditDistance + 1;
126 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
128 i->first, path, kAllowReplacements, kMaxValidEditDistance);
129 if (distance < min_distance && i->second) {
130 min_distance = distance;
155 *err =
"unknown target '" + path.
AsString() +
"'";
163 vector<Node*> root_nodes;
165 for (vector<Edge*>::const_iterator e =
edges_.begin();
167 for (vector<Node*>::const_iterator out = (*e)->outputs_.begin();
168 out != (*e)->outputs_.end(); ++out) {
169 if ((*out)->out_edges().empty())
170 root_nodes.push_back(*out);
174 if (!
edges_.empty() && root_nodes.empty())
175 *err =
"could not determine root nodes of build graph";
185 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i)
186 i->second->ResetState();
187 for (vector<Edge*>::iterator e =
edges_.begin(); e !=
edges_.end(); ++e) {
188 (*e)->outputs_ready_ =
false;
194 for (Paths::iterator i =
paths_.begin(); i !=
paths_.end(); ++i) {
195 Node* node = i->second;
196 printf(
"%s %s [id:%d]\n",
197 node->
path().c_str(),
203 printf(
"resource_pools:\n");
204 for (map<string, Pool*>::const_iterator it =
pools_.begin();
207 if (!it->second->name().empty()) {
vector< Edge * > edges_
All the edges of the graph.
const string & path() const
void EdgeScheduled(const Edge &edge)
informs this Pool that the given edge is committed to be run.
Node * GetNode(StringPiece path, uint64_t slash_bits)
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_
void AddIn(Edge *edge, StringPiece path, uint64_t slash_bits)
void AddOutEdge(Edge *edge)
An edge in the dependency graph; links between Nodes using Rules.
Node * LookupNode(StringPiece path) const
vector< Node * > DefaultNodes(string *error) const
Edge * AddEdge(const Rule *rule)
const string & name() const
void AddRule(const Rule *rule)
bool AddOut(Edge *edge, StringPiece path, uint64_t slash_bits)
void Dump()
Dump the nodes and Pools (useful for debugging).
An invokable build command and associated metadata (description, etc.).
vector< Node * > RootNodes(string *error) const
void Dump() const
Dump the Pool and its edges (useful for debugging).
void DelayEdge(Edge *edge)
adds the given edge to this Pool to be delayed.
A pool for delayed edges.
#define METRIC_RECORD(name)
The primary interface to metrics.
bool status_known() 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)
unsigned long long uint64_t
map< string, Pool * > pools_
All the pools used in the graph.
string AsString() const
Convert the slice into a full-fledged std::string, copying the data into a new string.
int EditDistance(const StringPiece &s1, const StringPiece &s2, bool allow_replacements, int max_edit_distance)
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_