Ninja
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Builder Struct Reference

Builder wraps the build process: starting commands, updating status. More...

#include <build.h>

Public Member Functions

NodeAddTarget (const string &name, string *err)
 
bool AddTarget (Node *target, 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 (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, string *err)
 Update status ninja logs following a command termination. More...
 
void SetBuildLog (BuildLog *log)
 Used for tests. More...
 
bool StartEdge (Edge *edge, string *err)
 
 ~Builder ()
 

Public Attributes

auto_ptr< CommandRunnercommand_runner_
 
const BuildConfigconfig_
 
Plan plan_
 
Statestate_
 
BuildStatusstatus_
 

Private Member Functions

 Builder (const Builder &other)
 
bool ExtractDeps (CommandRunner::Result *result, const string &deps_type, const string &deps_prefix, vector< Node * > *deps_nodes, string *err)
 
void operator= (const Builder &other)
 

Private Attributes

DiskInterfacedisk_interface_
 
DependencyScan scan_
 

Detailed Description

Builder wraps the build process: starting commands, updating status.

Definition at line 140 of file build.h.

Constructor & Destructor Documentation

Builder::Builder ( State state,
const BuildConfig config,
BuildLog build_log,
DepsLog deps_log,
DiskInterface disk_interface 
)

Definition at line 544 of file build.cc.

References status_.

Builder::~Builder ( )

Definition at line 552 of file build.cc.

References Cleanup().

Builder::Builder ( const Builder other)
private

Member Function Documentation

Node * Builder::AddTarget ( const string &  name,
string *  err 
)

Definition at line 586 of file build.cc.

References State::LookupNode(), and state_.

Referenced by BuildTest::RebuildTarget(), and TEST_F().

bool Builder::AddTarget ( Node target,
string *  err 
)

Add a target to the build, scanning dependencies.

Returns
false on error.

Definition at line 597 of file build.cc.

References Plan::AddTarget(), Node::in_edge(), plan_, DependencyScan::RecomputeDirty(), and scan_.

bool Builder::AlreadyUpToDate ( ) const

Returns true if the build targets are already up to date.

Definition at line 611 of file build.cc.

References Plan::more_to_do(), and plan_.

Referenced by Build(), and BuildTest::RebuildTarget().

bool Builder::Build ( string *  err)
void Builder::Cleanup ( )

Clean up after interrupted commands by deleting output files.

Definition at line 556 of file build.cc.

References command_runner_, disk_interface_, Error(), DiskInterface::RemoveFile(), and DiskInterface::Stat().

Referenced by Build(), and ~Builder().

bool Builder::ExtractDeps ( CommandRunner::Result result,
const string &  deps_type,
const string &  deps_prefix,
vector< Node * > *  deps_nodes,
string *  err 
)
private
bool Builder::FinishCommand ( CommandRunner::Result result,
string *  err 
)
void Builder::operator= ( const Builder other)
private
void Builder::SetBuildLog ( BuildLog log)
inline

Used for tests.

Definition at line 169 of file build.h.

References scan_, and DependencyScan::set_build_log().

Referenced by BuildWithLogTest::BuildWithLogTest().

bool Builder::StartEdge ( Edge edge,
string *  err 
)

Member Data Documentation

auto_ptr<CommandRunner> Builder::command_runner_
const BuildConfig& Builder::config_

Definition at line 174 of file build.h.

Referenced by Build(), and FinishCommand().

DiskInterface* Builder::disk_interface_
private

Definition at line 184 of file build.h.

Referenced by Cleanup(), ExtractDeps(), FinishCommand(), and StartEdge().

Plan Builder::plan_

Definition at line 175 of file build.h.

Referenced by AddTarget(), AlreadyUpToDate(), Build(), and FinishCommand().

DependencyScan Builder::scan_
private

Definition at line 185 of file build.h.

Referenced by AddTarget(), FinishCommand(), and SetBuildLog().

State* Builder::state_

Definition at line 173 of file build.h.

Referenced by AddTarget(), and ExtractDeps().

BuildStatus* Builder::status_

Definition at line 177 of file build.h.

Referenced by Build(), Builder(), FinishCommand(), and StartEdge().


The documentation for this struct was generated from the following files: