Use context manager to manage OS environment in tests

This is a follow up CL for gyp r1931, just for the code cleanup.  Inspired by Nico's gyp r1893.

BUG=gyp:434
TEST=unittest
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/321183002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1934 78cadc50-ecff-11dd-a971-7dbc132099af
Teach Ninja generator about 'AR' in 'make_global_settings'

With this CL, 'AR' in 'make_global_settings' can be recognized by Ninja generator, like Make generator. This makes it easier for you to share the code among host/NaCl/NDK/Emscripten build targets.

Note that 'AR.host' is not yet supported with this CL.

BUG=gyp:434
TEST=unittest
R=scottmg@chromium.org, torne@chromium.org

Review URL: https://codereview.chromium.org/321843002

git-svn-id: http://gyp.googlecode.com/svn/trunk@1935 78cadc50-ecff-11dd-a971-7dbc132099af
First crack at adding a GYP_GENERATOR for determining various things

This version reads a file to get a list of input files, then outputs
if any of the input files are contained as sources (or inputs to
actions/rules) in any targets.

R=mark@chromium.org

Patch by Scott Violet <sky@chromium.org>

Review URL: https://codereview.chromium.org/330053003

git-svn-id: http://gyp.googlecode.com/svn/trunk@1936 78cadc50-ecff-11dd-a971-7dbc132099af