15 #ifndef NINJA_BUILD_H_ 16 #define NINJA_BUILD_H_ 90 std::set<Edge*>* dyndep_walk);
112 bool EdgeMaybeReady(std::map<Edge*, Want>::iterator want_e, std::string* err);
117 void ScheduleWork(std::map<Edge*, Want>::iterator want_e);
200 bool Build(std::string* err);
219 #if __cplusplus < 201703L 228 const std::string& deps_prefix,
229 std::vector<Node*>* deps_nodes, std::string* err);
245 int* start_time,
int* end_time);
284 void SnprintfRate(
double rate,
char(&buf)[S],
const char* format)
const {
286 snprintf(buf, S,
"?");
288 snprintf(buf, S, format, rate);
338 #endif // NINJA_BUILD_H_
bool Build(std::string *err)
Run the build.
bool RefreshDyndepDependents(DependencyScan *scan, const Node *node, std::string *err)
CommandRunner is an interface that wraps running the build subcommands.
std::auto_ptr< CommandRunner > command_runner_
We do not want to build the edge, but we might want to build one of its dependents.
BuildStatus(const BuildConfig &config)
Store data loaded from one dyndep file.
double max_load_average
The maximum load average we must not exceed.
Plan stores the state of a build plan: what we intend to build, which steps we're ready to execute...
SlidingRateInfo current_rate_
void BuildEdgeFinished(Edge *edge, bool success, const std::string &output, int *start_time, int *end_time)
void UpdateRate(int edges)
The result of waiting for a command.
std::set< Edge * > ready_
std::string FormatProgressStatus(const char *progress_status_format, EdgeStatus status) const
Format the progress status string by replacing the placeholders.
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
virtual bool CanRunMore() const =0
bool DyndepsLoaded(DependencyScan *scan, const Node *node, const DyndepFile &ddf, std::string *err)
Update the build plan to account for modifications made to the graph by information loaded from a dyn...
Interface for accessing the disk.
const BuildConfig & config_
Plan(Builder *builder=NULL)
const BuildConfig & config_
bool StartEdge(Edge *edge, std::string *err)
std::map< const Edge *, int > RunningEdgeMap
Map of running edge to time the edge started running.
void Dump() const
Dumps the current state of the plan.
int command_edge_count() const
Number of edges with commands to run.
An edge in the dependency graph; links between Nodes using Rules.
void UpdateRate(int update_hint)
Store a log of every command ran for every build.
virtual std::vector< Edge * > GetActiveEdges()
DiskInterface * disk_interface_
std::map< Edge *, Want > want_
Keep track of which edges we want to build in this plan.
void ScheduleWork(std::map< Edge *, Want >::iterator want_e)
Submits a ready edge as a candidate for execution.
bool AddSubTarget(const Node *node, const Node *dependent, std::string *err, std::set< Edge *> *dyndep_walk)
Want
Enumerate possible steps we want for an edge.
As build commands run they can output extra dependency information (e.g.
signed long long int64_t
A 64-bit integer type.
void operator=(const Builder &other)
Builder(State *state, const BuildConfig &config, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface)
void Reset()
Reset state. Clears want and ready sets.
bool ExtractDeps(CommandRunner::Result *result, const std::string &deps_type, const std::string &deps_prefix, std::vector< Node *> *deps_nodes, std::string *err)
bool AddTarget(const Node *node, std::string *err)
Add a target to our plan (including all its dependencies).
Node * AddTarget(const std::string &name, std::string *err)
int64_t start_time_millis_
Time the build started.
void PrintStatus(const Edge *edge, EdgeStatus status)
int wanted_edges_
Total remaining number of wanted edges.
void Cleanup()
Clean up after interrupted commands by deleting output files.
void set_build_log(BuildLog *log)
bool EdgeMaybeReady(std::map< Edge *, Want >::iterator want_e, std::string *err)
We want to build the edge, but have not yet scheduled it.
std::queue< double > times_
double Elapsed() const
Seconds since Restart() call.
void SetBuildLog(BuildLog *log)
Used for tests.
Builder wraps the build process: starting commands, updating status.
bool LoadDyndeps(Node *node, std::string *err)
Load the dyndep information provided by the given node.
bool EdgeFinished(Edge *edge, EdgeResult result, std::string *err)
Mark an edge as done building (whether it succeeded or failed).
void PlanHasTotalEdges(int total)
Tracks the status of a build: completion fraction, printing updates.
void SnprintfRate(double rate, char(&buf)[S], const char *format) const
const char * progress_status_format_
The custom progress status format to use.
bool NodeFinished(Node *node, std::string *err)
Update plan with knowledge that the given node is up to date.
DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_re...
void EdgeWanted(const Edge *edge)
Options (e.g. verbosity, parallelism) passed to a build.
Global state (file status) for a single run.
Prints lines of text, possibly overprinting previously printed lines if the terminal supports it...
We want to build the edge, have scheduled it, and are waiting for it to complete. ...
bool CleanNode(DependencyScan *scan, Node *node, std::string *err)
Clean the given node during the build.
virtual bool WaitForCommand(Result *result)=0
Wait for a command to complete, or return false if interrupted.
RunningEdgeMap running_edges_
bool more_to_do() const
Returns true if there's more work to be done.
DepfileParserOptions depfile_parser_options
bool AlreadyUpToDate() const
Returns true if the build targets are already up to date.
LinePrinter printer_
Prints progress output.
A simple stopwatch which returns the time in seconds since Restart() was called.
int command_edges_
Total number of edges that have commands (not phony).
void UnmarkDependents(const Node *node, std::set< Node *> *dependents)
bool FinishCommand(CommandRunner::Result *result, std::string *err)
Update status ninja logs following a command termination.
void BuildEdgeStarted(const Edge *edge)
virtual bool StartCommand(Edge *edge)=0