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());
131 for (BuildLog::Entries::const_iterator i = entries.begin(); i != entries.end(); ++i) {
143 Remove(i->first.AsString());
153 if (!e->is_phony()) {
157 for (vector<Node*>::iterator n = e->inputs_.begin(); n != e->inputs_.end();
190 Error(
"unknown target '%s'", target);
200 for (
int i = 0; i < target_count; ++i) {
201 string target_name = targets[i];
202 if (target_name.empty()) {
203 Error(
"failed to canonicalize '': empty path");
212 printf(
"Target %s\n", target_name.c_str());
215 Error(
"unknown target '%s'", target_name.c_str());
226 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
228 if ((*e)->rule().name() == rule->
name()) {
229 for (vector<Node*>::iterator out_node = (*e)->outputs_.begin();
230 out_node != (*e)->outputs_.end(); ++out_node) {
231 Remove((*out_node)->path());
257 Error(
"unknown rule '%s'", rule);
269 for (
int i = 0; i < rule_count; ++i) {
270 const char* rule_name = rules[i];
274 printf(
"Rule %s\n", rule_name);
277 Error(
"unknown rule '%s'", rule_name);
294 for (vector<Edge*>::iterator e =
state_->
edges_.begin();
const Rule * LookupRule(const std::string &rule_name)
Options (e.g. verbosity, parallelism) passed to a build.
ExternalStringHashMap< std::unique_ptr< LogEntry > >::Type Entries
const BuildConfig & config_
int CleanRule(const Rule *rule)
Clean all the file built with the given rule rule.
int CleanTarget(Node *target)
Clean the given target and all the file built for it.
void RemoveEdgeFiles(Edge *edge)
Remove the depfile and rspfile for an Edge.
void DoCleanTarget(Node *target)
Helper recursive method for CleanTarget().
bool IsAlreadyRemoved(const std::string &path)
void Remove(const std::string &path)
Remove the given path file only if it has not been already removed.
int CleanRules(int rule_count, char *rules[])
Clean the file produced by the given rules.
void Report(const std::string &path)
DyndepLoader dyndep_loader_
void LoadDyndeps()
Load dependencies from dyndep bindings.
bool FileExists(const std::string &path)
Cleaner(State *state, const BuildConfig &config, DiskInterface *disk_interface)
Build a cleaner object with the given disk_interface.
void DoCleanRule(const Rule *rule)
std::set< std::string > removed_
std::set< Node * > cleaned_
int CleanTargets(int target_count, char *targets[])
Clean the given target targets.
int CleanDead(const BuildLog::Entries &entries)
Clean the files produced by previous builds that are no longer in the manifest.
int CleanAll(bool generator=false)
Clean all built files, except for files created by generator rules.
int RemoveFile(const std::string &path)
Remove the file path.
DiskInterface * disk_interface_
Interface for accessing the disk.
virtual int RemoveFile(const std::string &path)=0
Remove the file named 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.
An edge in the dependency graph; links between Nodes using Rules.
std::string GetUnescapedRspfile() const
Like GetBinding("rspfile"), but without shell escaping.
std::string GetUnescapedDepfile() const
Like GetBinding("depfile"), but without shell escaping.
Information about a node in the dependency graph: the file, whether it's dirty, mtime,...
const std::string & path() const
bool dyndep_pending() const
const std::vector< Edge * > & out_edges() const
An invocable build command and associated metadata (description, etc.).
const std::string & name() const
Global state (file status) for a single run.
std::vector< Edge * > edges_
All the edges of the graph.
Node * LookupNode(StringPiece path) const
void Error(const char *msg, va_list ap)
void CanonicalizePath(string *path, uint64_t *slash_bits)
unsigned long long uint64_t