32 dyndep_loader_(state, disk_interface),
33 cleaned_files_count_(0),
34 disk_interface_(disk_interface),
46 Error(
"%s", err.c_str());
53 printf(
"Remove %s\n", path.c_str());
73 set<string>::iterator i =
removed_.find(path);
90 printf(
"Cleaning...");
108 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
111 if ((*e)->is_phony())
114 if (!generator && (*e)->GetBindingBool(
"generator"))
116 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
117 out_node != (*e)->outputs_.end(); ++out_node) {
118 Remove((*out_node)->path());
130 for (BuildLog::Entries::const_iterator i = entries.begin(); i != entries.end(); ++i) {
133 Remove(i->first.AsString());
143 if (!e->is_phony()) {
147 for (vector<Node*>::iterator n = e->inputs_.begin(); n != e->inputs_.end();
180 Error(
"unknown target '%s'", target);
190 for (
int i = 0; i < target_count; ++i) {
191 string target_name = targets[i];
195 Error(
"failed to canonicalize '%s': %s", target_name.c_str(), err.c_str());
201 printf(
"Target %s\n", target_name.c_str());
204 Error(
"unknown target '%s'", target_name.c_str());
216 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
218 if ((*e)->rule().name() == rule->
name()) {
219 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
220 out_node != (*e)->outputs_.end(); ++out_node) {
221 Remove((*out_node)->path());
247 Error(
"unknown rule '%s'", rule);
259 for (
int i = 0; i < rule_count; ++i) {
260 const char* rule_name = rules[i];
264 printf(
"Rule %s\n", rule_name);
267 Error(
"unknown rule '%s'", rule_name);
284 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
286 if (
Node* dyndep = (*e)->dyndep_) {
const BuildConfig & config_
ExternalStringHashMap< LogEntry * >::Type Entries
int CleanTargets(int target_count, char *targets[])
Clean the given target targets.
bool CanonicalizePath(string *path, uint64_t *slash_bits, string *err)
std::set< std::string > removed_
const std::string & name() const
virtual int RemoveFile(const std::string &path)=0
Remove the file named path.
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
DyndepLoader dyndep_loader_
Interface for accessing the disk.
An edge in the dependency graph; links between Nodes using Rules.
Node * LookupNode(StringPiece path) const
std::set< Node * > cleaned_
DiskInterface * disk_interface_
const std::string & path() const
Cleaner(State *state, const BuildConfig &config, DiskInterface *disk_interface)
Build a cleaner object with the given disk_interface.
int RemoveFile(const std::string &path)
Remove the file path.
int CleanAll(bool generator=false)
Clean all built files, except for files created by generator rules.
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.
void LoadDyndeps()
Load dependencies from dyndep bindings.
bool IsAlreadyRemoved(const std::string &path)
std::string GetUnescapedRspfile() const
Like GetBinding("rspfile"), but without shell escaping.
int CleanDead(const BuildLog::Entries &entries)
Clean the files produced by previous builds that are no longer in the manifest.
const Rule * LookupRule(const std::string &rule_name)
void Remove(const std::string &path)
Remove the given path file only if it has not been already removed.
std::string GetUnescapedDepfile() const
Like GetBinding("depfile"), but without shell escaping.
void DoCleanRule(const Rule *rule)
void RemoveEdgeFiles(Edge *edge)
Remove the depfile and rspfile for an Edge.
Options (e.g. verbosity, parallelism) passed to a build.
Global state (file status) for a single run.
unsigned long long uint64_t
std::vector< Edge * > edges_
All the edges of the graph.
bool FileExists(const std::string &path)
void Report(const std::string &path)
virtual TimeStamp Stat(const std::string &path, std::string *err) const =0
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
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...
int CleanTarget(Node *target)
Clean the given target and all the file built for it.
void Error(const char *msg,...)
Log an error message.