diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build.cc | 2 | ||||
-rw-r--r-- | src/clean.cc | 2 | ||||
-rw-r--r-- | src/graph.cc | 8 | ||||
-rw-r--r-- | src/graph.h | 28 | ||||
-rw-r--r-- | src/ninja.cc | 4 |
5 files changed, 23 insertions, 21 deletions
diff --git a/src/build.cc b/src/build.cc index c69c967..4b54561 100644 --- a/src/build.cc +++ b/src/build.cc @@ -602,7 +602,7 @@ void Builder::FinishEdge(Edge* edge, bool success, const string& output) { restat_mtime = input_mtime; } - if (restat_mtime != 0 && !edge->rule().depfile_.empty()) { + if (restat_mtime != 0 && !edge->rule().depfile().empty()) { time_t depfile_mtime = disk_interface_->Stat(edge->EvaluateDepFile()); if (depfile_mtime == 0) restat_mtime = 0; diff --git a/src/clean.cc b/src/clean.cc index e8405f5..bb912f6 100644 --- a/src/clean.cc +++ b/src/clean.cc @@ -111,7 +111,7 @@ int Cleaner::CleanAll(bool generator) { out_node != (*e)->outputs_.end(); ++out_node) { Remove((*out_node)->path()); } - if (!(*e)->rule().depfile_.empty()) + if (!(*e)->rule().depfile().empty()) Remove((*e)->EvaluateDepFile()); } PrintFooter(); diff --git a/src/graph.cc b/src/graph.cc index be0c529..0656bdc 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -34,7 +34,7 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface, bool dirty = false; outputs_ready_ = true; - if (!rule_->depfile_.empty()) { + if (!rule_->depfile().empty()) { if (!LoadDepFile(state, disk_interface, err)) return false; } @@ -196,17 +196,17 @@ string EdgeEnv::MakePathList(vector<Node*>::iterator begin, string Edge::EvaluateCommand() { EdgeEnv env(this); - return rule_->command_.Evaluate(&env); + return rule_->command().Evaluate(&env); } string Edge::EvaluateDepFile() { EdgeEnv env(this); - return rule_->depfile_.Evaluate(&env); + return rule_->depfile().Evaluate(&env); } string Edge::GetDescription() { EdgeEnv env(this); - return rule_->description_.Evaluate(&env); + return rule_->description().Evaluate(&env); } bool Edge::LoadDepFile(State* state, DiskInterface* disk_interface, diff --git a/src/graph.h b/src/graph.h index 067d90e..fe102d2 100644 --- a/src/graph.h +++ b/src/graph.h @@ -104,21 +104,23 @@ struct Rule { bool generator() const { return generator_; } bool restat() const { return restat_; } -private: + const EvalString& command() const { return command_; } + const EvalString& description() const { return description_; } + const EvalString& depfile() const { return depfile_; } + + private: + // Allow the parsers to reach into this object and fill out its fields. + friend class ManifestParser; + friend class ParserTest; + string name_; - // TODO: make these private. But various tests want to reach into them... -public: + bool generator_; + bool restat_; + EvalString command_; EvalString description_; EvalString depfile_; - -private: - bool generator_, restat_; - - // Allow the parsers to reach into this object and fill out its fields. - friend class ManifestParser; - friend class ParserTest; }; struct BuildLog; @@ -130,9 +132,9 @@ struct Edge { Edge() : rule_(NULL), env_(NULL), outputs_ready_(false), implicit_deps_(0), order_only_deps_(0) {} - /// Examine inputs, outputs, and command lines to judge whether this edge needs - /// to be re-run, and update outputs_ready_ and each outputs' dirty_ state - /// accordingly. + /// Examine inputs, outputs, and command lines to judge whether this edge + /// needs to be re-run, and update outputs_ready_ and each outputs' |dirty_| + /// state accordingly. /// Returns false on failure. bool RecomputeDirty(State* state, DiskInterface* disk_interface, string* err); diff --git a/src/ninja.cc b/src/ninja.cc index 873bc6e..20584f9 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -364,12 +364,12 @@ int CmdTargets(State* state, int argc, char* argv[]) { int CmdRules(State* state, int argc, char* /* argv */[]) { for (map<string, const Rule*>::iterator i = state->rules_.begin(); i != state->rules_.end(); ++i) { - if (i->second->description_.unparsed_.empty()) { + if (i->second->description().unparsed_.empty()) { printf("%s\n", i->first.c_str()); } else { printf("%s: %s\n", i->first.c_str(), - i->second->description_.unparsed_.c_str()); + i->second->description().unparsed_.c_str()); } } return 0; |