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 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< CommandRunnercommand_runner_
 
const BuildConfigconfig_
 
Plan plan_
 
Statestate_
 
BuildStatusstatus_
 

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

DiskInterfacedisk_interface_
 
DependencyScan scan_
 

Detailed Description

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

Definition at line 180 of file build.h.

Constructor & Destructor Documentation

◆ Builder() [1/2]

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

Definition at line 730 of file build.cc.

References status_.

◆ ~Builder()

Builder::~Builder ( )

Definition at line 740 of file build.cc.

References Cleanup().

◆ Builder() [2/2]

Builder::Builder ( const Builder other)
private

Member Function Documentation

◆ AddTarget() [1/2]

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

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

◆ AddTarget() [2/2]

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

Add a target to the build, scanning dependencies.

Returns
false on error.

◆ AlreadyUpToDate()

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().

◆ Build()

bool Builder::Build ( std::string *  err)

◆ Cleanup()

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().

◆ ExtractDeps()

bool Builder::ExtractDeps ( CommandRunner::Result result,
const std::string &  deps_type,
const std::string &  deps_prefix,
std::vector< Node *> *  deps_nodes,
std::string *  err 
)
private

◆ FinishCommand()

bool Builder::FinishCommand ( CommandRunner::Result result,
std::string *  err 
)

◆ LoadDyndeps()

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().

◆ operator=()

void Builder::operator= ( const Builder other)
private

◆ SetBuildLog()

void Builder::SetBuildLog ( BuildLog log)
inline

Used for tests.

Definition at line 209 of file build.h.

References scan_, and DependencyScan::set_build_log().

◆ StartEdge()

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

Member Data Documentation

◆ command_runner_

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().

◆ config_

const BuildConfig& Builder::config_

Definition at line 217 of file build.h.

Referenced by Build(), ExtractDeps(), and FinishCommand().

◆ disk_interface_

DiskInterface* Builder::disk_interface_
private

Definition at line 231 of file build.h.

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

◆ plan_

Plan Builder::plan_

Definition at line 218 of file build.h.

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

◆ scan_

DependencyScan Builder::scan_
private

Definition at line 232 of file build.h.

Referenced by Build(), FinishCommand(), LoadDyndeps(), and SetBuildLog().

◆ state_

State* Builder::state_

Definition at line 216 of file build.h.

Referenced by ExtractDeps().

◆ status_

BuildStatus* Builder::status_

Definition at line 224 of file build.h.

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


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