15 #ifndef NINJA_BUILD_H_
16 #define NINJA_BUILD_H_
163 bool Build(
string* err);
181 vector<Node*>* deps_nodes,
string* err);
197 int* start_time,
int* end_time);
227 void snprinfRate(
double rate,
char(&buf)[S],
const char* format)
const {
228 if (rate == -1) snprintf(buf, S,
"?");
229 else snprintf(buf, S, format, rate);
279 #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)
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...
bool more_to_do() const
Returns true if there's more work to be done.
SlidingRateInfo current_rate_
void UpdateRate(int edges)
bool AddSubTarget(Node *node, vector< Node * > *stack, string *err)
The result of waiting for a command.
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 ResumeDelayedJobs(Edge *edge)
Allows jobs blocking on |edge| to potentially resume.
void ScheduleWork(Edge *edge)
Submits a ready edge as a candidate for execution.
Interface for accessing the disk.
const BuildConfig & config_
double Elapsed() const
Seconds since Restart() call.
const BuildConfig & config_
void CleanNode(DependencyScan *scan, Node *node)
Clean the given node during the build.
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.
bool AlreadyUpToDate() const
Returns true if the build targets are already up to date.
void BuildEdgeStarted(Edge *edge)
DiskInterface * disk_interface_
int command_edge_count() const
Number of edges with commands to run.
void EdgeFinished(Edge *edge)
Mark an edge as done building.
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)
map< Edge *, bool > want_
Keep track of which edges we want to build in this plan.
int64_t start_time_millis_
Time the build started.
int wanted_edges_
Total remaining number of wanted edges.
void FinishCommand(CommandRunner::Result *result)
void Cleanup()
Clean up after interrupted commands by deleting output files.
void set_build_log(BuildLog *log)
virtual bool CanRunMore()=0
auto_ptr< CommandRunner > command_runner_
void SetBuildLog(BuildLog *log)
Used for tests.
Builder wraps the build process: starting commands, updating status.
void PlanHasTotalEdges(int total)
void NodeFinished(Node *node)
bool CheckDependencyCycle(Node *node, vector< Node * > *stack, string *err)
map< Edge *, int > RunningEdgeMap
Map of running edge to time the edge started running.
Tracks the status of a build: completion fraction, printing updates.
bool ExtractDeps(CommandRunner::Result *result, const string &deps_type, vector< Node * > *deps_nodes, string *err)
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...
void PrintStatus(Edge *edge)
Options (e.g. verbosity, parallelism) passed to a build.
Global state (file status, loaded rules) for a single run.
Prints lines of text, possibly overprinting previously printed lines if the terminal supports it...
bool StartEdge(Edge *edge, string *err)
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.
string FormatProgressStatus(const char *progress_status_format) const
Format the progress status string by replacing the placeholders.
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).
void snprinfRate(double rate, char(&buf)[S], const char *format) const
virtual bool StartCommand(Edge *edge)=0