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

DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_ready state of all the nodes and edges. More...

#include <graph.h>

Public Member Functions

BuildLogbuild_log () const
 
 DependencyScan (State *state, BuildLog *build_log, DepsLog *deps_log, DiskInterface *disk_interface, DepfileParserOptions const *depfile_parser_options, Explanations *explanations)
 
DepsLogdeps_log () const
 
bool LoadDyndeps (Node *node, DyndepFile *ddf, std::string *err) const
 
bool LoadDyndeps (Node *node, std::string *err) const
 Load a dyndep file from the given node's path and update the build graph with the new information. More...
 
bool RecomputeDirty (Node *node, std::vector< Node * > *validation_nodes, std::string *err)
 Update the |dirty_| state of the given nodes by transitively inspecting their input edges. More...
 
bool RecomputeOutputsDirty (Edge *edge, Node *most_recent_input, bool *dirty, std::string *err)
 Recompute whether any output of the edge is dirty, if so sets |*dirty|. More...
 
void set_build_log (BuildLog *log)
 

Private Member Functions

bool RecomputeNodeDirty (Node *node, std::vector< Node * > *stack, std::vector< Node * > *validation_nodes, std::string *err)
 
bool RecomputeOutputDirty (const Edge *edge, const Node *most_recent_input, const std::string &command, Node *output)
 Recompute whether a given single output should be marked dirty. More...
 
void RecordExplanation (const Node *node, const char *fmt,...)
 
bool VerifyDAG (Node *node, std::vector< Node * > *stack, std::string *err)
 

Private Attributes

BuildLogbuild_log_
 
ImplicitDepLoader dep_loader_
 
DiskInterfacedisk_interface_
 
DyndepLoader dyndep_loader_
 
OptionalExplanations explanations_
 

Detailed Description

DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_ready state of all the nodes and edges.

Definition at line 332 of file graph.h.

Constructor & Destructor Documentation

◆ DependencyScan()

DependencyScan::DependencyScan ( State state,
BuildLog build_log,
DepsLog deps_log,
DiskInterface disk_interface,
DepfileParserOptions const *  depfile_parser_options,
Explanations explanations 
)
inline

Definition at line 333 of file graph.h.

Member Function Documentation

◆ build_log()

BuildLog* DependencyScan::build_log ( ) const
inline

Definition at line 356 of file graph.h.

References build_log_.

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

◆ deps_log()

DepsLog* DependencyScan::deps_log ( ) const
inline

Definition at line 363 of file graph.h.

References dep_loader_, and ImplicitDepLoader::deps_log().

Referenced by Builder::FinishCommand().

◆ LoadDyndeps() [1/2]

bool DependencyScan::LoadDyndeps ( Node node,
DyndepFile ddf,
std::string *  err 
) const

◆ LoadDyndeps() [2/2]

bool DependencyScan::LoadDyndeps ( Node node,
std::string *  err 
) const

Load a dyndep file from the given node's path and update the build graph with the new information.

One overload accepts a caller-owned 'DyndepFile' object in which to store the information loaded from the dyndep file.

Referenced by Builder::LoadDyndeps().

◆ RecomputeDirty()

bool DependencyScan::RecomputeDirty ( Node node,
std::vector< Node * > *  validation_nodes,
std::string *  err 
)

Update the |dirty_| state of the given nodes by transitively inspecting their input edges.

Examine inputs, outputs, and command lines to judge whether an edge needs to be re-run, and update outputs_ready_ and each outputs' |dirty_| state accordingly. Appends any validation nodes found to the nodes parameter. Returns false on failure.

Definition at line 49 of file graph.cc.

Referenced by Plan::RefreshDyndepDependents().

◆ RecomputeNodeDirty()

bool DependencyScan::RecomputeNodeDirty ( Node node,
std::vector< Node * > *  stack,
std::vector< Node * > *  validation_nodes,
std::string *  err 
)
private

◆ RecomputeOutputDirty()

bool DependencyScan::RecomputeOutputDirty ( const Edge edge,
const Node most_recent_input,
const std::string &  command,
Node output 
)
private

Recompute whether a given single output should be marked dirty.

Returns true if so.

Definition at line 278 of file graph.cc.

References BuildLog::LogEntry::command_hash, Node::exists(), Edge::GetBindingBool(), BuildLog::LogEntry::HashCommand(), Edge::inputs_, Edge::is_phony(), BuildLog::LogEntry::mtime, Node::mtime(), Node::path(), PRId64, and Node::UpdatePhonyMtime().

◆ RecomputeOutputsDirty()

bool DependencyScan::RecomputeOutputsDirty ( Edge edge,
Node most_recent_input,
bool *  dirty,
std::string *  err 
)

Recompute whether any output of the edge is dirty, if so sets |*dirty|.

Returns false on failure.

Definition at line 265 of file graph.cc.

References Edge::EvaluateCommand(), and Edge::outputs_.

Referenced by Plan::CleanNode().

◆ RecordExplanation()

void DependencyScan::RecordExplanation ( const Node node,
const char *  fmt,
  ... 
)
private

◆ set_build_log()

void DependencyScan::set_build_log ( BuildLog log)
inline

Definition at line 359 of file graph.h.

References build_log_.

Referenced by Builder::SetBuildLog().

◆ VerifyDAG()

bool DependencyScan::VerifyDAG ( Node node,
std::vector< Node * > *  stack,
std::string *  err 
)
private

Member Data Documentation

◆ build_log_

BuildLog* DependencyScan::build_log_
private

Definition at line 386 of file graph.h.

Referenced by build_log(), and set_build_log().

◆ dep_loader_

ImplicitDepLoader DependencyScan::dep_loader_
private

Definition at line 388 of file graph.h.

Referenced by deps_log().

◆ disk_interface_

DiskInterface* DependencyScan::disk_interface_
private

Definition at line 387 of file graph.h.

◆ dyndep_loader_

DyndepLoader DependencyScan::dyndep_loader_
private

Definition at line 389 of file graph.h.

◆ explanations_

OptionalExplanations DependencyScan::explanations_
private

Definition at line 390 of file graph.h.


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