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

Side by Side Diff: build/gyp_chromium

Issue 11377141: Selective build clobbering feature (landmines.py and android build scripts). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: formatting fix Created 8 years, 1 month 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/android/buildbot/buildbot_functions.sh ('k') | build/gyp_helper.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This script is wrapper for Chromium that adds some support for how GYP 7 # This script is wrapper for Chromium that adds some support for how GYP
8 # is invoked by Chromium beyond what can be done in the gclient hooks. 8 # is invoked by Chromium beyond what can be done in the gclient hooks.
9 9
10 import glob 10 import glob
11 import gyp_helper
11 import os 12 import os
12 import shlex 13 import shlex
13 import subprocess 14 import subprocess
14 import sys 15 import sys
15 16
16 script_dir = os.path.dirname(os.path.realpath(__file__)) 17 script_dir = os.path.dirname(os.path.realpath(__file__))
17 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 18 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
18 19
19 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 20 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
20 import gyp 21 import gyp
(...skipping 16 matching lines...) Expand all
37 # may not be worth it). 38 # may not be worth it).
38 if sys.platform == 'win32': 39 if sys.platform == 'win32':
39 try: 40 try:
40 sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32')) 41 sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32'))
41 import psyco 42 import psyco
42 except: 43 except:
43 psyco = None 44 psyco = None
44 else: 45 else:
45 psyco = None 46 psyco = None
46 47
47 def apply_gyp_environment(file_path=None):
48 """
49 Reads in a *.gyp_env file and applies the valid keys to os.environ.
50 """
51 if not file_path or not os.path.exists(file_path):
52 return
53 file_contents = open(file_path).read()
54 try:
55 file_data = eval(file_contents, {'__builtins__': None}, None)
56 except SyntaxError, e:
57 e.filename = os.path.abspath(file_path)
58 raise
59 supported_vars = ( 'CC',
60 'CHROMIUM_GYP_FILE',
61 'CHROMIUM_GYP_SYNTAX_CHECK',
62 'CXX',
63 'GYP_DEFINES',
64 'GYP_GENERATOR_FLAGS',
65 'GYP_GENERATOR_OUTPUT',
66 'GYP_GENERATORS', )
67 for var in supported_vars:
68 val = file_data.get(var)
69 if val:
70 if var in os.environ:
71 print 'INFO: Environment value for "%s" overrides value in %s.' % (
72 var, os.path.abspath(file_path)
73 )
74 else:
75 os.environ[var] = val
76
77 def additional_include_files(args=[]): 48 def additional_include_files(args=[]):
78 """ 49 """
79 Returns a list of additional (.gypi) files to include, without 50 Returns a list of additional (.gypi) files to include, without
80 duplicating ones that are already specified on the command line. 51 duplicating ones that are already specified on the command line.
81 """ 52 """
82 # Determine the include files specified on the command line. 53 # Determine the include files specified on the command line.
83 # This doesn't cover all the different option formats you can use, 54 # This doesn't cover all the different option formats you can use,
84 # but it's mainly intended to avoid duplicating flags on the automatic 55 # but it's mainly intended to avoid duplicating flags on the automatic
85 # makefile regeneration which only uses this format. 56 # makefile regeneration which only uses this format.
86 specified_includes = set() 57 specified_includes = set()
(...skipping 30 matching lines...) Expand all
117 if sys.platform == 'cygwin': 88 if sys.platform == 'cygwin':
118 python_dir = os.path.join(chrome_src, 'third_party', 'python_26') 89 python_dir = os.path.join(chrome_src, 'third_party', 'python_26')
119 env = os.environ.copy() 90 env = os.environ.copy()
120 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') 91 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '')
121 p = subprocess.Popen( 92 p = subprocess.Popen(
122 [os.path.join(python_dir, 'python.exe')] + sys.argv, 93 [os.path.join(python_dir, 'python.exe')] + sys.argv,
123 env=env, shell=False) 94 env=env, shell=False)
124 p.communicate() 95 p.communicate()
125 sys.exit(p.returncode) 96 sys.exit(p.returncode)
126 97
127 if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: 98 gyp_helper.apply_chromium_gyp_env()
128 # Update the environment based on chromium.gyp_env
129 gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env')
130 apply_gyp_environment(gyp_env_path)
131 99
132 # This could give false positives since it doesn't actually do real option 100 # This could give false positives since it doesn't actually do real option
133 # parsing. Oh well. 101 # parsing. Oh well.
134 gyp_file_specified = False 102 gyp_file_specified = False
135 for arg in args: 103 for arg in args:
136 if arg.endswith('.gyp'): 104 if arg.endswith('.gyp'):
137 gyp_file_specified = True 105 gyp_file_specified = True
138 break 106 break
139 107
140 # If we didn't get a file, check an env var, and then fall back to 108 # If we didn't get a file, check an env var, and then fall back to
(...skipping 25 matching lines...) Expand all
166 # to enfore syntax checking. 134 # to enfore syntax checking.
167 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') 135 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
168 if syntax_check and int(syntax_check): 136 if syntax_check and int(syntax_check):
169 args.append('--check') 137 args.append('--check')
170 138
171 print 'Updating projects from gyp files...' 139 print 'Updating projects from gyp files...'
172 sys.stdout.flush() 140 sys.stdout.flush()
173 141
174 # Off we go... 142 # Off we go...
175 sys.exit(gyp.main(args)) 143 sys.exit(gyp.main(args))
OLDNEW
« no previous file with comments | « build/android/buildbot/buildbot_functions.sh ('k') | build/gyp_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698