Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) | 32 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) |
| 33 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) | 33 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) |
| 34 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) | 34 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) |
| 35 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', | 35 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', |
| 36 'build_tools')) | 36 'build_tools')) |
| 37 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) | 37 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) |
| 38 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis')) | 38 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis')) |
| 39 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', | 39 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', |
| 40 'Source', 'build', 'scripts')) | 40 'Source', 'build', 'scripts')) |
| 41 | 41 |
| 42 import find_depot_tools | |
| 43 | |
| 44 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about | 42 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about |
| 45 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 | 43 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 |
| 46 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco | 44 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco |
| 47 # maxes out at about 158 MB vs. 132 MB without it. | 45 # maxes out at about 158 MB vs. 132 MB without it. |
| 48 # | 46 # |
| 49 # Psyco uses native libraries, so we need to load a different | 47 # Psyco uses native libraries, so we need to load a different |
| 50 # installation depending on which OS we are running under. It has not | 48 # installation depending on which OS we are running under. It has not |
| 51 # been tested whether using Psyco on our Mac and Linux builds is worth | 49 # been tested whether using Psyco on our Mac and Linux builds is worth |
| 52 # it (the GYP running time is a lot shorter, so the JIT startup cost | 50 # it (the GYP running time is a lot shorter, so the JIT startup cost |
| 53 # may not be worth it). | 51 # may not be worth it). |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 | 367 |
| 370 # Use the Psyco JIT if available. | 368 # Use the Psyco JIT if available. |
| 371 if psyco: | 369 if psyco: |
| 372 psyco.profile() | 370 psyco.profile() |
| 373 print "Enabled Psyco JIT." | 371 print "Enabled Psyco JIT." |
| 374 | 372 |
| 375 # Fall back on hermetic python if we happen to get run under cygwin. | 373 # Fall back on hermetic python if we happen to get run under cygwin. |
| 376 # TODO(bradnelson): take this out once this issue is fixed: | 374 # TODO(bradnelson): take this out once this issue is fixed: |
| 377 # http://code.google.com/p/gyp/issues/detail?id=177 | 375 # http://code.google.com/p/gyp/issues/detail?id=177 |
| 378 if sys.platform == 'cygwin': | 376 if sys.platform == 'cygwin': |
| 379 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | 377 depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
|
Paweł Hajdan Jr.
2014/02/10 18:43:24
find_depot_tools is actually used here (and a coup
| |
| 380 python_dir = sorted(glob.glob(os.path.join(depot_tools_path, | 378 python_dir = sorted(glob.glob(os.path.join(depot_tools_path, |
| 381 'python2*_bin')))[-1] | 379 'python2*_bin')))[-1] |
| 382 env = os.environ.copy() | 380 env = os.environ.copy() |
| 383 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') | 381 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') |
| 384 p = subprocess.Popen( | 382 p = subprocess.Popen( |
| 385 [os.path.join(python_dir, 'python.exe')] + sys.argv, | 383 [os.path.join(python_dir, 'python.exe')] + sys.argv, |
| 386 env=env, shell=False) | 384 env=env, shell=False) |
| 387 p.communicate() | 385 p.communicate() |
| 388 sys.exit(p.returncode) | 386 sys.exit(p.returncode) |
| 389 | 387 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 print('Using automatic toolchain in %s (%s edition).' % ( | 466 print('Using automatic toolchain in %s (%s edition).' % ( |
| 469 toolchain, 'Pro' if version_is_pro else 'Express')) | 467 toolchain, 'Pro' if version_is_pro else 'Express')) |
| 470 | 468 |
| 471 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check | 469 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check |
| 472 # to enfore syntax checking. | 470 # to enfore syntax checking. |
| 473 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 471 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
| 474 if syntax_check and int(syntax_check): | 472 if syntax_check and int(syntax_check): |
| 475 args.append('--check') | 473 args.append('--check') |
| 476 | 474 |
| 477 supplemental_includes = GetSupplementalFiles() | 475 supplemental_includes = GetSupplementalFiles() |
| 478 if not RunGN(supplemental_includes): | 476 if os.environ.get('GYP_GENERATORS') == 'ninja': |
| 479 sys.exit(1) | 477 import find_depot_tools |
|
Paweł Hajdan Jr.
2014/02/10 18:43:24
It's not obvious why find_depot_tools would be nee
| |
| 478 if not RunGN(supplemental_includes): | |
| 479 sys.exit(1) | |
| 480 | |
| 480 args.extend( | 481 args.extend( |
| 481 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) | 482 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) |
| 482 | 483 |
| 483 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) | 484 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) |
| 484 | 485 |
| 485 print 'Updating projects from gyp files...' | 486 print 'Updating projects from gyp files...' |
| 486 sys.stdout.flush() | 487 sys.stdout.flush() |
| 487 | 488 |
| 488 # Off we go... | 489 # Off we go... |
| 489 gyp_rc = gyp.main(args) | 490 gyp_rc = gyp.main(args) |
| 490 | 491 |
| 491 # Check for landmines (reasons to clobber the build). This must be run here, | 492 # Check for landmines (reasons to clobber the build). This must be run here, |
| 492 # rather than a separate runhooks step so that any environment modifications | 493 # rather than a separate runhooks step so that any environment modifications |
| 493 # from above are picked up. | 494 # from above are picked up. |
| 494 print 'Running build/landmines.py...' | 495 print 'Running build/landmines.py...' |
| 495 subprocess.check_call( | 496 subprocess.check_call( |
| 496 [sys.executable, os.path.join(script_dir, 'landmines.py')]) | 497 [sys.executable, os.path.join(script_dir, 'landmines.py')]) |
| 497 | 498 |
| 498 if vs2013_runtime_dll_dirs: | 499 if vs2013_runtime_dll_dirs: |
| 499 CopyVsRuntimeDlls(GetOutputDirectory(), vs2013_runtime_dll_dirs) | 500 CopyVsRuntimeDlls(GetOutputDirectory(), vs2013_runtime_dll_dirs) |
| 500 | 501 |
| 501 sys.exit(gyp_rc) | 502 sys.exit(gyp_rc) |
| OLD | NEW |