30 cleaned_files_count_(0),
42 cleaned_files_count_(0),
43 disk_interface_(disk_interface),
58 printf(
"Remove %s\n", path.c_str());
78 set<string>::iterator i =
removed_.find(path);
95 printf(
"Cleaning...");
111 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
114 if ((*e)->is_phony())
117 if (!generator && (*e)->GetBindingBool(
"generator"))
119 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
120 out_node != (*e)->outputs_.end(); ++out_node) {
121 Remove((*out_node)->path());
133 if (!e->is_phony()) {
137 for (vector<Node*>::iterator n = e->inputs_.begin(); n != e->inputs_.end();
169 Error(
"unknown target '%s'", target);
178 for (
int i = 0; i < target_count; ++i) {
179 const char* target_name = targets[i];
183 printf(
"Target %s\n", target_name);
186 Error(
"unknown target '%s'", target_name);
197 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
199 if ((*e)->rule().name() == rule->
name()) {
200 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
201 out_node != (*e)->outputs_.end(); ++out_node) {
202 Remove((*out_node)->path());
227 Error(
"unknown rule '%s'", rule);
238 for (
int i = 0; i < rule_count; ++i) {
239 const char* rule_name = rules[i];
243 printf(
"Rule %s\n", rule_name);
246 Error(
"unknown rule '%s'", rule_name);
const BuildConfig & config_
void Report(const string &path)
vector< Edge * > edges_
All the edges of the graph.
int CleanTargets(int target_count, char *targets[])
Clean the given target targets.
Cleaner(State *state, const BuildConfig &config)
Build a cleaner object with a real disk interface.
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
void Remove(const string &path)
Remove the given path file only if it has not been already removed.
Interface for accessing the disk.
An edge in the dependency graph; links between Nodes using Rules.
DiskInterface * disk_interface_
int RemoveFile(const string &path)
Remove the file path.
int CleanAll(bool generator=false)
Clean all built files, except for files created by generator rules.
Implementation of DiskInterface that actually hits the disk.
void DoCleanTarget(Node *target)
Helper recursive method for CleanTarget().
int CleanRule(const Rule *rule)
Clean all the file built with the given rule rule.
An invokable build command and associated metadata (description, etc.).
int CleanRules(int rule_count, char *rules[])
Clean the file produced by the given rules.
bool FileExists(const string &path)
Node * LookupNode(StringPiece path)
const string & path() const
string GetBinding(const string &key)
void DoCleanRule(const Rule *rule)
void RemoveEdgeFiles(Edge *edge)
Remove the depfile and rspfile for an Edge.
virtual int RemoveFile(const string &path)=0
Remove the file named path.
Options (e.g. verbosity, parallelism) passed to a build.
Global state (file status, loaded rules) for a single run.
const string & name() const
int CleanTarget(Node *target)
Clean the given target and all the file built for it.
bool IsAlreadyRemoved(const string &path)
virtual TimeStamp Stat(const string &path)=0
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
const Rule * LookupRule(const string &rule_name)
void Error(const char *msg,...)
Log an error message.