Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: build/gyp_helper.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/gyp_environment.py ('k') | build/gypi_to_gn.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # This file helps gyp_chromium and landmines correctly set up the gyp
6 # environment from chromium.gyp_env on disk
7
8 import os
9
10 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
11 CHROME_SRC = os.path.dirname(SCRIPT_DIR)
12
13
14 def apply_gyp_environment_from_file(file_path):
15 """Reads in a *.gyp_env file and applies the valid keys to os.environ."""
16 if not os.path.exists(file_path):
17 return
18 with open(file_path, 'rU') as f:
19 file_contents = f.read()
20 try:
21 file_data = eval(file_contents, {'__builtins__': None}, None)
22 except SyntaxError, e:
23 e.filename = os.path.abspath(file_path)
24 raise
25 supported_vars = (
26 'CC',
27 'CC_wrapper',
28 'CC.host_wrapper',
29 'CHROMIUM_GYP_FILE',
30 'CHROMIUM_GYP_SYNTAX_CHECK',
31 'CXX',
32 'CXX_wrapper',
33 'CXX.host_wrapper',
34 'GYP_DEFINES',
35 'GYP_GENERATOR_FLAGS',
36 'GYP_CROSSCOMPILE',
37 'GYP_GENERATOR_OUTPUT',
38 'GYP_GENERATORS',
39 'GYP_INCLUDE_FIRST',
40 'GYP_INCLUDE_LAST',
41 'GYP_MSVS_VERSION',
42 )
43 for var in supported_vars:
44 file_val = file_data.get(var)
45 if file_val:
46 if var in os.environ:
47 behavior = 'replaces'
48 if var == 'GYP_DEFINES':
49 result = file_val + ' ' + os.environ[var]
50 behavior = 'merges with, and individual components override,'
51 else:
52 result = os.environ[var]
53 print 'INFO: Environment value for "%s" %s value in %s' % (
54 var, behavior, os.path.abspath(file_path)
55 )
56 string_padding = max(len(var), len(file_path), len('result'))
57 print ' %s: %s' % (var.rjust(string_padding), os.environ[var])
58 print ' %s: %s' % (file_path.rjust(string_padding), file_val)
59 os.environ[var] = result
60 else:
61 os.environ[var] = file_val
62
63
64 def apply_chromium_gyp_env():
65 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
66 # Update the environment based on chromium.gyp_env
67 path = os.path.join(os.path.dirname(CHROME_SRC), 'chromium.gyp_env')
68 apply_gyp_environment_from_file(path)
OLDNEW
« no previous file with comments | « build/gyp_environment.py ('k') | build/gypi_to_gn.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698