summaryrefslogtreecommitdiffstats
path: root/build/gyp_environment.py
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-14 14:03:30 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-14 14:04:59 +0000
commit9372becb96814e31181d143ecbcef57c38ccea2b (patch)
treebf5c2ef436ced651de646ca77ce856aee19f4428 /build/gyp_environment.py
parent158479473c39ae05be58c88bbcad0be5ada5680c (diff)
downloadchromium_src-9372becb96814e31181d143ecbcef57c38ccea2b.zip
chromium_src-9372becb96814e31181d143ecbcef57c38ccea2b.tar.gz
chromium_src-9372becb96814e31181d143ecbcef57c38ccea2b.tar.bz2
Make landmines work on local builds too
Moves (some of) gyp environment setup out of gyp_chromium into separate module, and shares that between gyp_chromium and landmines.py. landmines.py is added as the first entry in DEPS hooks so that it can clobber the entire build directory before running other hooks that extract/generate into the build dir. Reland with fix for ios, and for clean pull. R=iannucci@chromium.org BUG=400011 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289099 Review URL: https://codereview.chromium.org/457003004 Cr-Commit-Position: refs/heads/master@{#289546} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/gyp_environment.py')
-rw-r--r--build/gyp_environment.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/build/gyp_environment.py b/build/gyp_environment.py
new file mode 100644
index 0000000..fb50645
--- /dev/null
+++ b/build/gyp_environment.py
@@ -0,0 +1,33 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Sets up various automatic gyp environment variables. These are used by
+gyp_chromium and landmines.py which run at different stages of runhooks. To
+make sure settings are consistent between them, all setup should happen here.
+"""
+
+import gyp_helper
+import os
+import sys
+import vs_toolchain
+
+def SetEnvironment():
+ """Sets defaults for GYP_* variables."""
+ gyp_helper.apply_chromium_gyp_env()
+
+ # Default to ninja on linux and windows, but only if no generator has
+ # explicitly been set.
+ # Also default to ninja on mac, but only when not building chrome/ios.
+ # . -f / --format has precedence over the env var, no need to check for it
+ # . set the env var only if it hasn't been set yet
+ # . chromium.gyp_env has been applied to os.environ at this point already
+ if sys.platform.startswith(('linux', 'win', 'freebsd')) and \
+ not os.environ.get('GYP_GENERATORS'):
+ os.environ['GYP_GENERATORS'] = 'ninja'
+ elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \
+ not 'OS=ios' in os.environ.get('GYP_DEFINES', []):
+ os.environ['GYP_GENERATORS'] = 'ninja'
+
+ vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()