15 #ifndef NINJA_BUILD_H_ 16 #define NINJA_BUILD_H_ 179 bool Build(
string* err);
195 #if __cplusplus < 201703L 204 const string& deps_prefix, vector<Node*>* deps_nodes,
221 int* start_time,
int* end_time);
259 void SnprintfRate(
double rate,
char(&buf)[S],
const char* format)
const {
261 snprintf(buf, S,
"?");
263 snprintf(buf, S, format, rate);
313 #endif // NINJA_BUILD_H_
CommandRunner is an interface that wraps running the build subcommands.
void BuildEdgeFinished(Edge *edge, bool success, const string &output, int *start_time, int *end_time)
We do not want to build the edge, but we might want to build one of its dependents.
BuildStatus(const BuildConfig &config)
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 UpdateRate(int edges)
bool ExtractDeps(CommandRunner::Result *result, const string &deps_type, const string &deps_prefix, vector< Node *> *deps_nodes, string *err)
The result of waiting for a command.
string FormatProgressStatus(const char *progress_status_format, EdgeStatus status) const
Format the progress status string by replacing the placeholders.
bool AddTarget(Node *node, string *err)
Add a target to our plan (including all its dependencies).
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
void ScheduleWork(map< Edge *, Want >::iterator want_e)
Submits a ready edge as a candidate for execution.
bool AddSubTarget(Node *node, Node *dependent, string *err)
Interface for accessing the disk.
const BuildConfig & config_
void PrintStatus(Edge *edge, EdgeStatus status)
const BuildConfig & config_
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.
void BuildEdgeStarted(Edge *edge)
DiskInterface * disk_interface_
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 FinishCommand(CommandRunner::Result *result, string *err)
Update status ninja logs following a command termination.
int64_t start_time_millis_
Time the build started.
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)
virtual bool CanRunMore()=0
We want to build the edge, but have not yet scheduled it.
map< Edge *, Want > want_
Keep track of which edges we want to build in this plan.
auto_ptr< CommandRunner > command_runner_
double Elapsed() const
Seconds since Restart() call.
void SetBuildLog(BuildLog *log)
Used for tests.
Builder wraps the build process: starting commands, updating status.
void PlanHasTotalEdges(int total)
void NodeFinished(Node *node)
map< Edge *, int > RunningEdgeMap
Map of running edge to time the edge started running.
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.
virtual vector< Edge * > GetActiveEdges()
DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_re...
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...
bool StartEdge(Edge *edge, string *err)
We want to build the edge, have scheduled it, and are waiting for it to complete. ...
void Dump()
Dumps the current state of the plan.
virtual bool WaitForCommand(Result *result)=0
Wait for a command to complete, or return false if interrupted.
RunningEdgeMap running_edges_
bool Build(string *err)
Run the build.
bool more_to_do() const
Returns true if there's more work to be done.
bool CleanNode(DependencyScan *scan, Node *node, string *err)
Clean the given node during the build.
void EdgeFinished(Edge *edge, EdgeResult result)
Mark an edge as done building (whether it succeeded or failed).
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.
Node * AddTarget(const string &name, string *err)
int command_edges_
Total number of edges that have commands (not phony).
virtual bool StartCommand(Edge *edge)=0