|
Ninja
|
Builder wraps the build process: starting commands, updating status. More...
#include <build.h>
Public Member Functions | |
| Node * | AddTarget (const std::string &name, std::string *err) |
| bool | AddTarget (Node *target, std::string *err) |
| Add a target to the build, scanning dependencies. More... | |
| bool | AlreadyUpToDate () const |
| Returns true if the build targets are already up to date. More... | |
| bool | Build (std::string *err) |
| Run the build. More... | |
| Builder (State *state, const BuildConfig &config, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface) | |
| void | Cleanup () |
| Clean up after interrupted commands by deleting output files. More... | |
| bool | FinishCommand (CommandRunner::Result *result, std::string *err) |
| Update status ninja logs following a command termination. More... | |
| bool | LoadDyndeps (Node *node, std::string *err) |
| Load the dyndep information provided by the given node. More... | |
| void | SetBuildLog (BuildLog *log) |
| Used for tests. More... | |
| bool | StartEdge (Edge *edge, std::string *err) |
| ~Builder () | |
Public Attributes | |
| std::auto_ptr< CommandRunner > | command_runner_ |
| const BuildConfig & | config_ |
| Plan | plan_ |
| State * | state_ |
| BuildStatus * | status_ |
Private Member Functions | |
| Builder (const Builder &other) | |
| bool | ExtractDeps (CommandRunner::Result *result, const std::string &deps_type, const std::string &deps_prefix, std::vector< Node *> *deps_nodes, std::string *err) |
| void | operator= (const Builder &other) |
Private Attributes | |
| DiskInterface * | disk_interface_ |
| DependencyScan | scan_ |
Builder wraps the build process: starting commands, updating status.
| Builder::Builder | ( | State * | state, |
| const BuildConfig & | config, | ||
| BuildLog * | build_log, | ||
| DepsLog * | deps_log, | ||
| DiskInterface * | disk_interface | ||
| ) |
|
private |
| Node* Builder::AddTarget | ( | const std::string & | name, |
| std::string * | err | ||
| ) |
Referenced by BuildTest::RebuildTarget(), and TEST_F().
| bool Builder::AddTarget | ( | Node * | target, |
| std::string * | err | ||
| ) |
Add a target to the build, scanning dependencies.
| bool Builder::AlreadyUpToDate | ( | ) | const |
Returns true if the build targets are already up to date.
Definition at line 800 of file build.cc.
References Plan::more_to_do(), and plan_.
Referenced by Build(), and BuildTest::RebuildTarget().
| bool Builder::Build | ( | std::string * | err | ) |
Run the build.
Returns false on error. It is an error to call this function when AlreadyUpToDate() is true.
Definition at line 804 of file build.cc.
References AlreadyUpToDate(), DependencyScan::build_log(), BuildStatus::BuildFinished(), BuildStatus::BuildStarted(), Cleanup(), BuildLog::Close(), Plan::command_edge_count(), command_runner_, config_, BuildConfig::dry_run, Plan::EdgeFinished(), ExitInterrupted, BuildConfig::failures_allowed, Plan::FindWork(), FinishCommand(), Edge::GetBindingBool(), Edge::is_phony(), Plan::kEdgeSucceeded, Plan::more_to_do(), plan_, BuildStatus::PlanHasTotalEdges(), scan_, StartEdge(), CommandRunner::Result::status, status_, and CommandRunner::Result::success().
Referenced by BuildTest::RebuildTarget(), and TEST_F().
| void Builder::Cleanup | ( | ) |
Clean up after interrupted commands by deleting output files.
Definition at line 744 of file build.cc.
References command_runner_, disk_interface_, Error(), DiskInterface::RemoveFile(), and DiskInterface::Stat().
Referenced by Build(), and ~Builder().
|
private |
Definition at line 1054 of file build.cc.
References CanonicalizePath(), config_, BuildConfig::depfile_parser_options, disk_interface_, CommandRunner::Result::edge, Fatal(), g_keep_depfile, State::GetNode(), Edge::GetUnescapedDepfile(), CLParser::includes_, DepfileParser::ins_, FileReader::NotFound, FileReader::Okay, FileReader::OtherError, CommandRunner::Result::output, DepfileParser::Parse(), CLParser::Parse(), FileReader::ReadFile(), DiskInterface::RemoveFile(), and state_.
Referenced by FinishCommand().
| bool Builder::FinishCommand | ( | CommandRunner::Result * | result, |
| std::string * | err | ||
| ) |
Update status ninja logs following a command termination.
Definition at line 935 of file build.cc.
References DependencyScan::build_log(), BuildStatus::BuildEdgeFinished(), Plan::CleanNode(), Plan::command_edge_count(), config_, DependencyScan::deps_log(), disk_interface_, BuildConfig::dry_run, CommandRunner::Result::edge, Plan::EdgeFinished(), ExitFailure, ExtractDeps(), g_keep_rsp, Edge::GetBinding(), Edge::GetBindingBool(), Edge::GetUnescapedDepfile(), Edge::GetUnescapedRspfile(), Edge::inputs_, Plan::kEdgeFailed, Plan::kEdgeSucceeded, METRIC_RECORD, Edge::order_only_deps_, CommandRunner::Result::output, Edge::outputs_, plan_, BuildStatus::PlanHasTotalEdges(), BuildLog::RecordCommand(), DepsLog::RecordDeps(), DiskInterface::RemoveFile(), scan_, DiskInterface::Stat(), CommandRunner::Result::status, status_, and CommandRunner::Result::success().
Referenced by Build().
| bool Builder::LoadDyndeps | ( | Node * | node, |
| std::string * | err | ||
| ) |
Load the dyndep information provided by the given node.
Definition at line 1122 of file build.cc.
References BuildStatus::BuildLoadDyndeps(), Plan::command_edge_count(), Plan::DyndepsLoaded(), DependencyScan::LoadDyndeps(), plan_, BuildStatus::PlanHasTotalEdges(), scan_, and status_.
Referenced by Plan::NodeFinished().
|
private |
|
inline |
Used for tests.
Definition at line 209 of file build.h.
References scan_, and DependencyScan::set_build_log().
| bool Builder::StartEdge | ( | Edge * | edge, |
| std::string * | err | ||
| ) |
Definition at line 902 of file build.cc.
References BuildStatus::BuildEdgeStarted(), command_runner_, disk_interface_, Edge::EvaluateCommand(), Edge::GetBinding(), Edge::GetUnescapedRspfile(), Edge::is_phony(), DiskInterface::MakeDirs(), METRIC_RECORD, Edge::outputs_, status_, and DiskInterface::WriteFile().
Referenced by Build().
| std::auto_ptr<CommandRunner> Builder::command_runner_ |
Definition at line 220 of file build.h.
Referenced by Build(), Cleanup(), BuildTest::RebuildTarget(), StartEdge(), and TEST_F().
| const BuildConfig& Builder::config_ |
Definition at line 217 of file build.h.
Referenced by Build(), ExtractDeps(), and FinishCommand().
|
private |
Definition at line 231 of file build.h.
Referenced by Cleanup(), ExtractDeps(), FinishCommand(), and StartEdge().
| Plan Builder::plan_ |
Definition at line 218 of file build.h.
Referenced by AlreadyUpToDate(), Build(), FinishCommand(), and LoadDyndeps().
|
private |
Definition at line 232 of file build.h.
Referenced by Build(), FinishCommand(), LoadDyndeps(), and SetBuildLog().
| State* Builder::state_ |
Definition at line 216 of file build.h.
Referenced by ExtractDeps().
| BuildStatus* Builder::status_ |
Definition at line 224 of file build.h.
Referenced by Build(), Builder(), FinishCommand(), LoadDyndeps(), and StartEdge().
1.8.14