On Mon, Aug 20, 2012 at 8:10 AM, Richard Geary <richar...@gmail.com> wrote:The global-ity of rules is an an oversight -- it was quicker to
> Why are targets starting with "build" or "rule" global, not file scoped?
implement one map of names to rules than it would've been to implement
a tree of maps. It wouldn't be too hard to fix.
I'm not sure what you mean about "build", though. I think it's
necessary that all build edges contribute to one global view...?
Yes, please go ahead, or file a bug and I'll take care of it
> When I use subninja, I was expecting these to be scoped to the file in which
> they're defined. Could I change this behaviour?
eventually. There's even a TODO for it somewhere (maybe in gyp). The
pattern used in eval_env.h, with a map and a pointer to an enclosing
scope, would probably do the trick.
One subtlety is there are ninja commands like "-t rules" that claim to
list all the rules, which means we'll need to figure out how to print
rules with the same name in a non-confusing way. On the other hand
the code for that tool itself already has a comment about how its
output is bogus...
I think there's never been too much pressure for it because most
projects have one set of "global" rules (like the compiler) that get
well-known names and then the occasional subproject-specific rule
which can just have its name qualified with the project name (I think
that's what we did in gyp).