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...
 
void FinishCommand (CommandRunner::Result *result)
 
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, 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 143 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 523 of file build.cc.

References status_.

Builder::~Builder ( )

Definition at line 531 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 563 of file build.cc.

References State::LookupNode(), and state_.

Referenced by TEST_F().

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

Add a target to the build, scanning dependencies.

Returns
false on error.

Definition at line 574 of file build.cc.

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

bool Builder::AlreadyUpToDate ( ) const

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

Definition at line 589 of file build.cc.

References Plan::more_to_do(), and plan_.

Referenced by Build().

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

Clean up after interrupted commands by deleting output files.

Definition at line 535 of file build.cc.

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

Referenced by ~Builder().

bool Builder::ExtractDeps ( CommandRunner::Result result,
const string &  deps_type,
vector< Node * > *  deps_nodes,
string *  err 
)
private
void Builder::FinishCommand ( CommandRunner::Result result)
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_

Definition at line 176 of file build.h.

Referenced by Build(), Cleanup(), BuildTest::SetUp(), StartEdge(), TEST_F(), and BuildTest::~BuildTest().

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 183 of file build.h.

Referenced by AddTarget(), 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 184 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: