|
Ninja
|
Plan stores the state of a build plan: what we intend to build, which steps we're ready to execute. More...
#include <build.h>
Public Types | |
| enum | EdgeResult { kEdgeFailed, kEdgeSucceeded } |
Public Member Functions | |
| bool | AddTarget (Node *node, string *err) |
| Add a target to our plan (including all its dependencies). More... | |
| bool | CleanNode (DependencyScan *scan, Node *node, string *err) |
| Clean the given node during the build. More... | |
| int | command_edge_count () const |
| Number of edges with commands to run. More... | |
| void | Dump () |
| Dumps the current state of the plan. More... | |
| void | EdgeFinished (Edge *edge, EdgeResult result) |
| Mark an edge as done building (whether it succeeded or failed). More... | |
| Edge * | FindWork () |
| bool | more_to_do () const |
| Returns true if there's more work to be done. More... | |
| Plan () | |
| void | Reset () |
| Reset state. Clears want and ready sets. More... | |
Private Types | |
| enum | Want { kWantNothing, kWantToStart, kWantToFinish } |
| Enumerate possible steps we want for an edge. More... | |
Private Member Functions | |
| bool | AddSubTarget (Node *node, Node *dependent, string *err) |
| void | NodeFinished (Node *node) |
| void | ScheduleWork (map< Edge *, Want >::iterator want_e) |
| Submits a ready edge as a candidate for execution. More... | |
Private Attributes | |
| int | command_edges_ |
| Total number of edges that have commands (not phony). More... | |
| set< Edge * > | ready_ |
| map< Edge *, Want > | want_ |
| Keep track of which edges we want to build in this plan. More... | |
| int | wanted_edges_ |
| Total remaining number of wanted edges. More... | |
Plan stores the state of a build plan: what we intend to build, which steps we're ready to execute.
| enum Plan::EdgeResult |
|
private |
Enumerate possible steps we want for an edge.
Definition at line 303 of file build.cc.
References Edge::AllInputsReady(), command_edges_, Node::dirty(), Node::in_edge(), Edge::inputs_, Edge::is_phony(), kWantNothing, kWantToStart, Edge::outputs_ready(), Node::path(), ScheduleWork(), want_, and wanted_edges_.
Referenced by AddTarget().
| bool Plan::AddTarget | ( | Node * | node, |
| string * | err | ||
| ) |
Add a target to our plan (including all its dependencies).
Returns false if we don't need to build this target; may fill in |err| with an error message if there's a problem.
Definition at line 299 of file build.cc.
References AddSubTarget().
Referenced by Builder::AddTarget(), TEST_F(), and PlanTest::TestPoolWithDepthOne().
| bool Plan::CleanNode | ( | DependencyScan * | scan, |
| Node * | node, | ||
| string * | err | ||
| ) |
Clean the given node during the build.
Return false on error.
Definition at line 426 of file build.cc.
References command_edges_, Node::dirty(), kWantNothing, MEM_FN, Node::mtime(), Node::out_edges(), DependencyScan::RecomputeOutputsDirty(), Node::set_dirty(), want_, and wanted_edges_.
Referenced by Builder::FinishCommand().
|
inline |
Number of edges with commands to run.
Definition at line 73 of file build.h.
References command_edges_.
Referenced by Builder::Build(), Builder::FinishCommand(), and TEST_F().
| void Plan::Dump | ( | ) |
Dumps the current state of the plan.
Definition at line 483 of file build.cc.
References kWantNothing, ready_, and want_.
| void Plan::EdgeFinished | ( | Edge * | edge, |
| EdgeResult | result | ||
| ) |
Mark an edge as done building (whether it succeeded or failed).
Definition at line 379 of file build.cc.
References Pool::EdgeFinished(), kEdgeSucceeded, kWantNothing, NodeFinished(), Edge::outputs_, Edge::outputs_ready_, Edge::pool(), ready_, Pool::RetrieveReadyEdges(), want_, and wanted_edges_.
Referenced by Builder::Build(), Builder::FinishCommand(), NodeFinished(), and PlanTest::TestPoolWithDepthOne().
| Edge * Plan::FindWork | ( | ) |
Definition at line 348 of file build.cc.
References ready_.
Referenced by Builder::Build(), PlanTest::FindWorkSorted(), and PlanTest::TestPoolWithDepthOne().
|
inline |
Returns true if there's more work to be done.
Definition at line 55 of file build.h.
References command_edges_, and wanted_edges_.
Referenced by Builder::AlreadyUpToDate(), Builder::Build(), PlanTest::FindWorkSorted(), TEST_F(), and PlanTest::TestPoolWithDepthOne().
|
private |
Definition at line 405 of file build.cc.
References EdgeFinished(), kEdgeSucceeded, kWantNothing, Node::out_edges(), ScheduleWork(), and want_.
Referenced by EdgeFinished().
| void Plan::Reset | ( | ) |
Reset state. Clears want and ready sets.
Definition at line 292 of file build.cc.
References command_edges_, ready_, want_, and wanted_edges_.
Submits a ready edge as a candidate for execution.
The edge may be delayed from running, for example if it's a member of a currently-full pool.
Definition at line 357 of file build.cc.
References Pool::DelayEdge(), Pool::EdgeScheduled(), kWantToFinish, kWantToStart, Edge::pool(), ready_, Pool::RetrieveReadyEdges(), and Pool::ShouldDelayEdge().
Referenced by AddSubTarget(), and NodeFinished().
|
private |
Total number of edges that have commands (not phony).
Definition at line 109 of file build.h.
Referenced by AddSubTarget(), CleanNode(), command_edge_count(), more_to_do(), and Reset().
|
private |
Definition at line 106 of file build.h.
Referenced by Dump(), EdgeFinished(), FindWork(), Reset(), and ScheduleWork().
Keep track of which edges we want to build in this plan.
If this map does not contain an entry for an edge, we do not want to build the entry or its dependents. If it does contain an entry, the enumeration indicates what we want for the edge.
Definition at line 104 of file build.h.
Referenced by AddSubTarget(), CleanNode(), Dump(), EdgeFinished(), NodeFinished(), and Reset().
|
private |
Total remaining number of wanted edges.
Definition at line 112 of file build.h.
Referenced by AddSubTarget(), CleanNode(), EdgeFinished(), more_to_do(), and Reset().
1.8.14