30 cleaned_files_count_(0),
42 cleaned_files_count_(0),
43 disk_interface_(disk_interface),
55 Error(
"%s", err.c_str());
62 printf(
"Remove %s\n", path.c_str());
82 set<string>::iterator i =
removed_.find(path);
99 printf(
"Cleaning...");
116 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
119 if ((*e)->is_phony())
122 if (!generator && (*e)->GetBindingBool(
"generator"))
124 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
125 out_node != (*e)->outputs_.end(); ++out_node) {
126 Remove((*out_node)->path());
138 if (!e->is_phony()) {
142 for (vector<Node*>::iterator n = e->inputs_.begin(); n != e->inputs_.end();
174 Error(
"unknown target '%s'", target);
183 for (
int i = 0; i < target_count; ++i) {
184 string target_name = targets[i];
188 Error(
"failed to canonicalize '%s': %s", target_name.c_str(), err.c_str());
194 printf(
"Target %s\n", target_name.c_str());
197 Error(
"unknown target '%s'", target_name.c_str());
209 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
211 if ((*e)->rule().name() == rule->
name()) {
212 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
213 out_node != (*e)->outputs_.end(); ++out_node) {
214 Remove((*out_node)->path());
239 Error(
"unknown rule '%s'", rule);
250 for (
int i = 0; i < rule_count; ++i) {
251 const char* rule_name = rules[i];
255 printf(
"Rule %s\n", rule_name);
258 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.
const Rule * LookupRule(const string &rule_name)
const string & path() const
bool CanonicalizePath(string *path, uint64_t *slash_bits, string *err)
Canonicalize a path like "foo/../bar.h" into just "bar.h".
Cleaner(State *state, const BuildConfig &config)
Build a cleaner object with a real disk interface.
string GetUnescapedRspfile()
Like GetBinding("rspfile"), but without shell escaping.
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.
Node * LookupNode(StringPiece path) const
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)
virtual TimeStamp Stat(const string &path, string *err) const =0
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
void DoCleanRule(const Rule *rule)
const string & name() const
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) for a single run.
unsigned long long uint64_t
string GetUnescapedDepfile()
Like GetBinding("depfile"), but without shell escaping.
int CleanTarget(Node *target)
Clean the given target and all the file built for it.
bool IsAlreadyRemoved(const string &path)
void Error(const char *msg,...)
Log an error message.