OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """This script is wrapper for Chromium that adds some support for how GYP | 5 """This script is wrapper for Chromium that adds some support for how GYP |
6 is invoked by Chromium beyond what can be done in the gclient hooks. | 6 is invoked by Chromium beyond what can be done in the gclient hooks. |
7 """ | 7 """ |
8 | 8 |
9 import argparse | 9 import argparse |
10 import gc | 10 import gc |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 args = sys.argv[1:] | 204 args = sys.argv[1:] |
205 | 205 |
206 use_analyzer = len(args) and args[0] == '--analyzer' | 206 use_analyzer = len(args) and args[0] == '--analyzer' |
207 if use_analyzer: | 207 if use_analyzer: |
208 args.pop(0) | 208 args.pop(0) |
209 os.environ['GYP_GENERATORS'] = 'analyzer' | 209 os.environ['GYP_GENERATORS'] = 'analyzer' |
210 args.append('-Gconfig_path=' + args.pop(0)) | 210 args.append('-Gconfig_path=' + args.pop(0)) |
211 args.append('-Ganalyzer_output_path=' + args.pop(0)) | 211 args.append('-Ganalyzer_output_path=' + args.pop(0)) |
212 | 212 |
213 if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): | 213 gyp_chromium_no_action = os.environ.get('GYP_CHROMIUM_NO_ACTION') |
| 214 if gyp_chromium_no_action == '1': |
214 print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.' | 215 print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.' |
215 sys.exit(0) | 216 sys.exit(0) |
216 | 217 |
217 # Use the Psyco JIT if available. | 218 # Use the Psyco JIT if available. |
218 if psyco: | 219 if psyco: |
219 psyco.profile() | 220 psyco.profile() |
220 print "Enabled Psyco JIT." | 221 print "Enabled Psyco JIT." |
221 | 222 |
222 # Fall back on hermetic python if we happen to get run under cygwin. | 223 # Fall back on hermetic python if we happen to get run under cygwin. |
223 # TODO(bradnelson): take this out once this issue is fixed: | 224 # TODO(bradnelson): take this out once this issue is fixed: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 args.extend( | 322 args.extend( |
322 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) | 323 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) |
323 | 324 |
324 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) | 325 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) |
325 | 326 |
326 mac_toolchain_dir = mac_toolchain.GetToolchainDirectory() | 327 mac_toolchain_dir = mac_toolchain.GetToolchainDirectory() |
327 if mac_toolchain_dir: | 328 if mac_toolchain_dir: |
328 args.append('-Gmac_toolchain_dir=' + mac_toolchain_dir) | 329 args.append('-Gmac_toolchain_dir=' + mac_toolchain_dir) |
329 mac_toolchain.SetToolchainEnvironment() | 330 mac_toolchain.SetToolchainEnvironment() |
330 | 331 |
331 # TODO(crbug.com/432967) - We are eventually going to switch GYP off | |
332 # by default for all Chromium builds, so this list of configurations | |
333 # will get broader and broader. | |
334 running_as_hook = '--running-as-hook' | 332 running_as_hook = '--running-as-hook' |
335 if (running_as_hook in args and | 333 if running_as_hook in args and gyp_chromium_no_action != '0': |
336 os.environ.get('GYP_CHROMIUM_NO_ACTION', None) != '0' and | 334 print 'GYP is now disabled by default in runhooks.\n' |
337 ((sys.platform.startswith('linux') and not gyp_vars_dict) or | |
338 (gyp_vars_dict.get('OS') == 'android'))): | |
339 print 'GYP is now disabled in this configuration by default in runhooks.\n' | |
340 print 'If you really want to run this, either run ' | 335 print 'If you really want to run this, either run ' |
341 print '`python build/gyp_chromium.py` explicitly by hand' | 336 print '`python build/gyp_chromium.py` explicitly by hand' |
342 print 'or set the environment variable GYP_CHROMIUM_NO_ACTION=0.' | 337 print 'or set the environment variable GYP_CHROMIUM_NO_ACTION=0.' |
343 sys.exit(0) | 338 sys.exit(0) |
344 | 339 |
345 if running_as_hook in args: | 340 if running_as_hook in args: |
346 args.remove(running_as_hook) | 341 args.remove(running_as_hook) |
347 | 342 |
348 if not use_analyzer: | 343 if not use_analyzer: |
349 print 'Updating projects from gyp files...' | 344 print 'Updating projects from gyp files...' |
350 sys.stdout.flush() | 345 sys.stdout.flush() |
351 | 346 |
352 # Off we go... | 347 # Off we go... |
353 gyp_rc = gyp.main(args) | 348 gyp_rc = gyp.main(args) |
354 | 349 |
355 if gyp_rc == 0 and not use_analyzer: | 350 if gyp_rc == 0 and not use_analyzer: |
356 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() | 351 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() |
357 if vs2013_runtime_dll_dirs: | 352 if vs2013_runtime_dll_dirs: |
358 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs | 353 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs |
359 vs_toolchain.CopyVsRuntimeDlls( | 354 vs_toolchain.CopyVsRuntimeDlls( |
360 os.path.join(chrome_src, GetOutputDirectory()), | 355 os.path.join(chrome_src, GetOutputDirectory()), |
361 (x86_runtime, x64_runtime)) | 356 (x86_runtime, x64_runtime)) |
362 | 357 |
363 sys.exit(gyp_rc) | 358 sys.exit(gyp_rc) |
364 | 359 |
365 if __name__ == '__main__': | 360 if __name__ == '__main__': |
366 sys.exit(main()) | 361 sys.exit(main()) |
OLD | NEW |