15 #ifndef NINJA_BUILD_H_
16 #define NINJA_BUILD_H_
106 std::set<Edge*>* dyndep_walk);
119 bool EdgeMaybeReady(std::map<Edge*, Want>::iterator want_e, std::string* err);
124 void ScheduleWork(std::map<Edge*, Want>::iterator want_e);
251 const std::string& deps_prefix,
252 std::vector<Node*>* deps_nodes, std::string* err);
A Jobserver::Client instance models a client of an external GNU jobserver pool, which can be implemen...
Options (e.g. verbosity, parallelism) passed to a build.
DepfileParserOptions depfile_parser_options
double max_load_average
The maximum load average we must not exceed.
bool disable_jobserver_client
Store a log of every command ran for every build.
Builder wraps the build process: starting commands, updating status.
std::unique_ptr< Jobserver::Client > jobserver_
void SetJobserverClient(std::unique_ptr< Jobserver::Client > jobserver_client)
Set Jobserver client instance for this builder.
std::map< const Edge *, int > RunningEdgeMap
Map of running edge to time the edge started running.
std::string lock_file_path_
void SetFailureCode(ExitStatus code)
Builder(State *state, const BuildConfig &config, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface, Status *status, int64_t start_time_millis)
void Cleanup()
Clean up after interrupted commands by deleting output files.
bool AddTarget(Node *target, std::string *err)
Add a target to the build, scanning dependencies.
int64_t start_time_millis_
Time the build started.
bool ExtractDeps(CommandRunner::Result *result, const std::string &deps_type, const std::string &deps_prefix, std::vector< Node * > *deps_nodes, std::string *err)
bool FinishCommand(CommandRunner::Result *result, std::string *err)
Update status ninja logs following a command termination.
ExitStatus GetExitCode() const
Returns ExitStatus or the exit code of the last failed job (doesn't need to be an enum value of ExitS...
RunningEdgeMap running_edges_
const BuildConfig & config_
void operator=(const Builder &other)
DiskInterface * disk_interface_
bool AlreadyUpToDate() const
Returns true if the build targets are already up to date.
ExitStatus Build(std::string *err)
Run the build.
bool StartEdge(Edge *edge, std::string *err)
std::unique_ptr< CommandRunner > command_runner_
ExitStatus exit_code_
Keep the global exit code for the build.
Builder(const Builder &other)
std::unique_ptr< Explanations > explanations_
void SetBuildLog(BuildLog *log)
Used for tests.
bool LoadDyndeps(Node *node, std::string *err)
Load the dyndep information provided by the given node.
Node * AddTarget(const std::string &name, std::string *err)
The result of waiting for a command.
CommandRunner is an interface that wraps running the build subcommands.
virtual bool StartCommand(Edge *edge)=0
virtual bool WaitForCommand(Result *result)=0
Wait for a command to complete, or return false if interrupted.
virtual std::vector< Edge * > GetActiveEdges()
virtual size_t CanRunMore() const =0
static CommandRunner * factory(const BuildConfig &config, Jobserver::Client *jobserver)
Creates the RealCommandRunner.
DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_re...
void set_build_log(BuildLog *log)
As build commands run they can output extra dependency information (e.g.
Interface for accessing the disk.
Store data loaded from one dyndep file.
An edge in the dependency graph; links between Nodes using Rules.
A class used to record a list of explanation strings associated with a given 'item' pointer.
Information about a node in the dependency graph: the file, whether it's dirty, mtime,...
Plan stores the state of a build plan: what we intend to build, which steps we're ready to execute.
bool AddSubTarget(const Node *node, const Node *dependent, std::string *err, std::set< Edge * > *dyndep_walk)
int command_edge_count() const
Number of edges with commands to run.
int command_edges_
Total number of edges that have commands (not phony).
void Reset()
Reset state. Clears want and ready sets.
bool EdgeMaybeReady(std::map< Edge *, Want >::iterator want_e, std::string *err)
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...
void ScheduleInitialEdges()
bool AddTarget(const Node *target, std::string *err)
Add a target to our plan (including all its dependencies).
bool more_to_do() const
Returns true if there's more work to be done.
int wanted_edges_
Total remaining number of wanted edges.
void Dump() const
Dumps the current state of the plan.
bool RefreshDyndepDependents(DependencyScan *scan, const Node *node, std::string *err)
Want
Enumerate possible steps we want for an edge.
@ kWantNothing
We do not want to build the edge, but we might want to build one of its dependents.
@ kWantToFinish
We want to build the edge, have scheduled it, and are waiting for it to complete.
@ kWantToStart
We want to build the edge, but have not yet scheduled it.
void ScheduleWork(std::map< Edge *, Want >::iterator want_e)
Submits a ready edge as a candidate for execution.
std::map< Edge *, Want > want_
Keep track of which edges we want to build in this plan.
void ComputeCriticalPath()
void EdgeWanted(const Edge *edge)
std::vector< const Node * > targets_
user provided targets in build order, earlier one have higher priority
void UnmarkDependents(const Node *node, std::set< Node * > *dependents)
bool EdgeFinished(Edge *edge, EdgeResult result, std::string *err)
Mark an edge as done building (whether it succeeded or failed).
Plan(Builder *builder=NULL)
bool CleanNode(DependencyScan *scan, Node *node, std::string *err)
Clean the given node during the build.
bool NodeFinished(Node *node, std::string *err)
Update plan with knowledge that the given node is up to date.
Global state (file status) for a single run.
Abstract interface to object that tracks the status of a build: completion fraction,...
signed long long int64_t
A 64-bit integer type.