Add --experimentalEnvvar support

This CL completes the work started in http://aosp/2319309 by adding the
new assignment grammar that sets env variables inside a subninja chdir:

```
subninja b/build.ninja
  env OUT = build
  chdir = b
```

The modified environment gets used when edges from inside the subninja chdir
are executed.

Note that setting environment variables within a ninja file is still
considered somewhat buggy and may be removed suddenly in the future because
ninja makes no guarantees about any *other* environment variables, nor are
builds hermetically sealed against such changes in the environment. A ninja
file using this kind of assignment from this CL is doing it to add some
kind of environment variable guaranttes, and ninja does not support that
at this time. An easy way to improve the build is to "bake" environment
variable assignments into a wrapper script. Then ninja would execute the
wrapper script (instead of directly calling the underlying command).

Hermetic build environments are becoming a de facto best practice as
they make caching and build troubleshooting simpler.

Warning: a further pitfall awaits for Windows builds, since posix builds
have an implicit /bin/sh prepended to all commands. Windows builds will
get the modified environment vars from this CL but since there is no
command shell to expand them, the called program must itself know how to
handle environment variable expansion, or the Windows build must use a
different ninja rule - such as a wrapper script like mentioned above.

Change-Id: I6a3de2cbfa361f6b6723851fd87b04db0058a8a6
3 files changed