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

Side by Side Diff: build/gyp_chromium

Issue 457003004: Make landmines work on local builds too (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « DEPS ('k') | build/gyp_environment.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 gyp_environment
12 import os 12 import os
13 import re 13 import re
14 import shlex 14 import shlex
15 import subprocess 15 import subprocess
16 import string 16 import string
17 import sys 17 import sys
18 import vs_toolchain 18 import vs_toolchain
19 19
20 script_dir = os.path.dirname(os.path.realpath(__file__)) 20 script_dir = os.path.dirname(os.path.realpath(__file__))
21 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 21 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 # TODO(sky): remove analyzer2 once updated recipes. 192 # TODO(sky): remove analyzer2 once updated recipes.
193 use_analyzer = len(args) and (args[0] == '--analyzer' or 193 use_analyzer = len(args) and (args[0] == '--analyzer' or
194 args[0] == '--analyzer2') 194 args[0] == '--analyzer2')
195 if use_analyzer: 195 if use_analyzer:
196 args.pop(0) 196 args.pop(0)
197 os.environ['GYP_GENERATORS'] = 'analyzer' 197 os.environ['GYP_GENERATORS'] = 'analyzer'
198 args.append('-Gconfig_path=' + args.pop(0)) 198 args.append('-Gconfig_path=' + args.pop(0))
199 args.append('-Ganalyzer_output_path=' + args.pop(0)) 199 args.append('-Ganalyzer_output_path=' + args.pop(0))
200 200
201 if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): 201 if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)):
202 # Check for landmines (reasons to clobber the build) in any case.
203 print 'Running build/landmines.py...'
204 subprocess.check_call(
205 [sys.executable, os.path.join(script_dir, 'landmines.py')])
206 print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.' 202 print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.'
207 sys.exit(0) 203 sys.exit(0)
208 204
209 # Use the Psyco JIT if available. 205 # Use the Psyco JIT if available.
210 if psyco: 206 if psyco:
211 psyco.profile() 207 psyco.profile()
212 print "Enabled Psyco JIT." 208 print "Enabled Psyco JIT."
213 209
214 # Fall back on hermetic python if we happen to get run under cygwin. 210 # Fall back on hermetic python if we happen to get run under cygwin.
215 # TODO(bradnelson): take this out once this issue is fixed: 211 # TODO(bradnelson): take this out once this issue is fixed:
216 # http://code.google.com/p/gyp/issues/detail?id=177 212 # http://code.google.com/p/gyp/issues/detail?id=177
217 if sys.platform == 'cygwin': 213 if sys.platform == 'cygwin':
218 import find_depot_tools 214 import find_depot_tools
219 depot_tools_path = find_depot_tools.add_depot_tools_to_path() 215 depot_tools_path = find_depot_tools.add_depot_tools_to_path()
220 python_dir = sorted(glob.glob(os.path.join(depot_tools_path, 216 python_dir = sorted(glob.glob(os.path.join(depot_tools_path,
221 'python2*_bin')))[-1] 217 'python2*_bin')))[-1]
222 env = os.environ.copy() 218 env = os.environ.copy()
223 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') 219 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '')
224 p = subprocess.Popen( 220 p = subprocess.Popen(
225 [os.path.join(python_dir, 'python.exe')] + sys.argv, 221 [os.path.join(python_dir, 'python.exe')] + sys.argv,
226 env=env, shell=False) 222 env=env, shell=False)
227 p.communicate() 223 p.communicate()
228 sys.exit(p.returncode) 224 sys.exit(p.returncode)
229 225
230 gyp_helper.apply_chromium_gyp_env()
231
232 # This could give false positives since it doesn't actually do real option 226 # This could give false positives since it doesn't actually do real option
233 # parsing. Oh well. 227 # parsing. Oh well.
234 gyp_file_specified = False 228 gyp_file_specified = False
235 for arg in args: 229 for arg in args:
236 if arg.endswith('.gyp'): 230 if arg.endswith('.gyp'):
237 gyp_file_specified = True 231 gyp_file_specified = True
238 break 232 break
239 233
240 # If we didn't get a file, check an env var, and then fall back to 234 # If we didn't get a file, check an env var, and then fall back to
241 # assuming 'all.gyp' from the same directory as the script. 235 # assuming 'all.gyp' from the same directory as the script.
242 if not gyp_file_specified: 236 if not gyp_file_specified:
243 gyp_file = os.environ.get('CHROMIUM_GYP_FILE') 237 gyp_file = os.environ.get('CHROMIUM_GYP_FILE')
244 if gyp_file: 238 if gyp_file:
245 # Note that CHROMIUM_GYP_FILE values can't have backslashes as 239 # Note that CHROMIUM_GYP_FILE values can't have backslashes as
246 # path separators even on Windows due to the use of shlex.split(). 240 # path separators even on Windows due to the use of shlex.split().
247 args.extend(shlex.split(gyp_file)) 241 args.extend(shlex.split(gyp_file))
248 else: 242 else:
249 args.append(os.path.join(script_dir, 'all.gyp')) 243 args.append(os.path.join(script_dir, 'all.gyp'))
250 244
245 vs2013_runtime_dll_dirs = gyp_environment.SetEnvironment()
246
251 # There shouldn't be a circular dependency relationship between .gyp files, 247 # There shouldn't be a circular dependency relationship between .gyp files,
252 # but in Chromium's .gyp files, on non-Mac platforms, circular relationships 248 # but in Chromium's .gyp files, on non-Mac platforms, circular relationships
253 # currently exist. The check for circular dependencies is currently 249 # currently exist. The check for circular dependencies is currently
254 # bypassed on other platforms, but is left enabled on the Mac, where a 250 # bypassed on other platforms, but is left enabled on the Mac, where a
255 # violation of the rule causes Xcode to misbehave badly. 251 # violation of the rule causes Xcode to misbehave badly.
256 # TODO(mark): Find and kill remaining circular dependencies, and remove this 252 # TODO(mark): Find and kill remaining circular dependencies, and remove this
257 # option. http://crbug.com/35878. 253 # option. http://crbug.com/35878.
258 # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the 254 # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the
259 # list. 255 # list.
260 if sys.platform not in ('darwin',): 256 if sys.platform not in ('darwin',):
261 args.append('--no-circular-check') 257 args.append('--no-circular-check')
262 258
263 # We explicitly don't support the make gyp generator (crbug.com/348686). Be 259 # We explicitly don't support the make gyp generator (crbug.com/348686). Be
264 # nice and fail here, rather than choking in gyp. 260 # nice and fail here, rather than choking in gyp.
265 if re.search(r'(^|,|\s)make($|,|\s)', os.environ.get('GYP_GENERATORS', '')): 261 if re.search(r'(^|,|\s)make($|,|\s)', os.environ.get('GYP_GENERATORS', '')):
266 print 'Error: make gyp generator not supported (check GYP_GENERATORS).' 262 print 'Error: make gyp generator not supported (check GYP_GENERATORS).'
267 sys.exit(1) 263 sys.exit(1)
268 264
269 # Default to ninja on linux and windows, but only if no generator has
270 # explicitly been set.
271 # Also default to ninja on mac, but only when not building chrome/ios.
272 # . -f / --format has precedence over the env var, no need to check for it
273 # . set the env var only if it hasn't been set yet
274 # . chromium.gyp_env has been applied to os.environ at this point already
275 if sys.platform.startswith(('linux', 'win', 'freebsd')) and \
276 not os.environ.get('GYP_GENERATORS'):
277 os.environ['GYP_GENERATORS'] = 'ninja'
278 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \
279 not 'OS=ios' in os.environ.get('GYP_DEFINES', []):
280 os.environ['GYP_GENERATORS'] = 'ninja'
281
282 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
283
284 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check 265 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check
285 # to enfore syntax checking. 266 # to enfore syntax checking.
286 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') 267 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
287 if syntax_check and int(syntax_check): 268 if syntax_check and int(syntax_check):
288 args.append('--check') 269 args.append('--check')
289 270
290 supplemental_includes = GetSupplementalFiles() 271 supplemental_includes = GetSupplementalFiles()
scottmg 2014/08/12 17:22:12 All this stuff could/should be moved to gyp_enviro
291 gyp_vars_dict = GetGypVars(supplemental_includes) 272 gyp_vars_dict = GetGypVars(supplemental_includes)
292 273
293 # TODO(dmikurube): Remove these checks and messages after a while. 274 # TODO(dmikurube): Remove these checks and messages after a while.
294 if ('linux_use_tcmalloc' in gyp_vars_dict or 275 if ('linux_use_tcmalloc' in gyp_vars_dict or
295 'android_use_tcmalloc' in gyp_vars_dict): 276 'android_use_tcmalloc' in gyp_vars_dict):
296 print '*****************************************************************' 277 print '*****************************************************************'
297 print '"linux_use_tcmalloc" and "android_use_tcmalloc" are deprecated!' 278 print '"linux_use_tcmalloc" and "android_use_tcmalloc" are deprecated!'
298 print '-----------------------------------------------------------------' 279 print '-----------------------------------------------------------------'
299 print 'You specify "linux_use_tcmalloc" or "android_use_tcmalloc" in' 280 print 'You specify "linux_use_tcmalloc" or "android_use_tcmalloc" in'
300 print 'your GYP_DEFINES. Please switch them into "use_allocator" now.' 281 print 'your GYP_DEFINES. Please switch them into "use_allocator" now.'
(...skipping 16 matching lines...) Expand all
317 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) 298 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()])
318 299
319 if not use_analyzer: 300 if not use_analyzer:
320 print 'Updating projects from gyp files...' 301 print 'Updating projects from gyp files...'
321 sys.stdout.flush() 302 sys.stdout.flush()
322 303
323 # Off we go... 304 # Off we go...
324 gyp_rc = gyp.main(args) 305 gyp_rc = gyp.main(args)
325 306
326 if not use_analyzer: 307 if not use_analyzer:
327 # Check for landmines (reasons to clobber the build). This must be run here,
328 # rather than a separate runhooks step so that any environment modifications
329 # from above are picked up.
330 print 'Running build/landmines.py...'
331 subprocess.check_call(
332 [sys.executable, os.path.join(script_dir, 'landmines.py')])
333
334 if vs2013_runtime_dll_dirs: 308 if vs2013_runtime_dll_dirs:
335 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs 309 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
336 vs_toolchain.CopyVsRuntimeDlls( 310 vs_toolchain.CopyVsRuntimeDlls(
337 os.path.join(chrome_src, GetOutputDirectory()), 311 os.path.join(chrome_src, GetOutputDirectory()),
338 (x86_runtime, x64_runtime)) 312 (x86_runtime, x64_runtime))
339 313
340 sys.exit(gyp_rc) 314 sys.exit(gyp_rc)
OLDNEW
« no previous file with comments | « DEPS ('k') | build/gyp_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698