diff options
author | Mohamed Bamakhrama <mohamed.bamakhrama@intel.com> | 2015-03-01 23:57:33 (GMT) |
---|---|---|
committer | Mohamed Bamakhrama <mohamed.bamakhrama@intel.com> | 2015-03-01 23:57:33 (GMT) |
commit | f8f293730de2e12f6575c5d890a16504340f75fe (patch) | |
tree | f4544bb3ab1fea478c57a2892616a5761c5769f6 /src/graph.cc | |
parent | c406d1c8adfedc1982e2c08ab95d581f65eb65de (diff) | |
download | Ninja-f8f293730de2e12f6575c5d890a16504340f75fe.zip Ninja-f8f293730de2e12f6575c5d890a16504340f75fe.tar.gz Ninja-f8f293730de2e12f6575c5d890a16504340f75fe.tar.bz2 |
Allow scoping rules through subninja
Ninja didn't support scoping rules through subninja and assumed
a unique rule name in the whole namespace. With this change, this
behavior is changed to allow scoping rules. Two rules can have the
same name if they belong to two different scopes. However, two
rules can NOT have the same name in the same scope.
Diffstat (limited to 'src/graph.cc')
-rw-r--r-- | src/graph.cc | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/graph.cc b/src/graph.cc index 6b977eb..cbf7921 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -33,30 +33,6 @@ bool Node::Stat(DiskInterface* disk_interface) { return mtime_ > 0; } -void Rule::AddBinding(const string& key, const EvalString& val) { - bindings_[key] = val; -} - -const EvalString* Rule::GetBinding(const string& key) const { - map<string, EvalString>::const_iterator i = bindings_.find(key); - if (i == bindings_.end()) - return NULL; - return &i->second; -} - -// static -bool Rule::IsReservedBinding(const string& var) { - return var == "command" || - var == "depfile" || - var == "description" || - var == "deps" || - var == "generator" || - var == "pool" || - var == "restat" || - var == "rspfile" || - var == "rspfile_content"; -} - bool DependencyScan::RecomputeDirty(Edge* edge, string* err) { bool dirty = false; edge->outputs_ready_ = true; @@ -231,6 +207,7 @@ struct EdgeEnv : public Env { EdgeEnv(Edge* edge, EscapeKind escape) : edge_(edge), escape_in_out_(escape) {} virtual string LookupVariable(const string& var); + virtual const Rule* LookupRule(const string& rule_name); /// Given a span of Nodes, construct a list of paths suitable for a command /// line. @@ -242,6 +219,10 @@ struct EdgeEnv : public Env { EscapeKind escape_in_out_; }; +const Rule* EdgeEnv::LookupRule(const string& rule_name) { + return NULL; +} + string EdgeEnv::LookupVariable(const string& var) { if (var == "in" || var == "in_newline") { int explicit_deps_count = edge_->inputs_.size() - edge_->implicit_deps_ - |