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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 # Need to pass both the source root (the bots don't run this command from | 323 # Need to pass both the source root (the bots don't run this command from |
| 324 # within the source tree) as well as set the is_gyp value so the BUILD files | 324 # within the source tree) as well as set the is_gyp value so the BUILD files |
| 325 # to know they're being run under GYP. | 325 # to know they're being run under GYP. |
| 326 args = [gnpath, 'gyp', '-q', | 326 args = [gnpath, 'gyp', '-q', |
| 327 '--root=' + chrome_src, | 327 '--root=' + chrome_src, |
| 328 '--args=' + GetArgsStringForGN(vars_dict), | 328 '--args=' + GetArgsStringForGN(vars_dict), |
| 329 '--output=//' + GetOutputDirectory() + '/gn_build/'] | 329 '--output=//' + GetOutputDirectory() + '/gn_build/'] |
| 330 return subprocess.call(args) == 0 | 330 return subprocess.call(args) == 0 |
| 331 | 331 |
| 332 | 332 |
| 333 def GetDesiredVsToolchainHashes(): | |
| 334 """Load a list of SHA1s corresponding to the toolchains that we want installed | |
| 335 to build with.""" | |
| 336 sha1path = os.path.join(script_dir, 'toolchain_vs2013.hash') | |
| 337 with open(sha1path, 'rb') as f: | |
| 338 return f.read().strip().splitlines() | |
| 339 | |
| 340 | |
| 333 def CopyVsRuntimeDlls(output_dir, runtime_dirs): | 341 def CopyVsRuntimeDlls(output_dir, runtime_dirs): |
| 334 """Copies the VS runtime DLLs from the given |runtime_dirs| to the output | 342 """Copies the VS runtime DLLs from the given |runtime_dirs| to the output |
| 335 directory so that even if not system-installed, built binaries are likely to | 343 directory so that even if not system-installed, built binaries are likely to |
| 336 be able to run. | 344 be able to run. |
| 337 | 345 |
| 338 This needs to be run after gyp has been run so that the expected target | 346 This needs to be run after gyp has been run so that the expected target |
| 339 output directories are already created. | 347 output directories are already created. |
| 340 """ | 348 """ |
| 341 assert sys.platform.startswith(('win32', 'cygwin')) | 349 assert sys.platform.startswith(('win32', 'cygwin')) |
| 342 | 350 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 # . set the env var only if it hasn't been set yet | 439 # . set the env var only if it hasn't been set yet |
| 432 # . chromium.gyp_env has been applied to os.environ at this point already | 440 # . chromium.gyp_env has been applied to os.environ at this point already |
| 433 if sys.platform.startswith('linux') and not os.environ.get('GYP_GENERATORS'): | 441 if sys.platform.startswith('linux') and not os.environ.get('GYP_GENERATORS'): |
| 434 os.environ['GYP_GENERATORS'] = 'ninja' | 442 os.environ['GYP_GENERATORS'] = 'ninja' |
| 435 if sys.platform.startswith('win') and not os.environ.get('GYP_GENERATORS'): | 443 if sys.platform.startswith('win') and not os.environ.get('GYP_GENERATORS'): |
| 436 os.environ['GYP_GENERATORS'] = 'ninja' | 444 os.environ['GYP_GENERATORS'] = 'ninja' |
| 437 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \ | 445 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \ |
| 438 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): | 446 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): |
| 439 os.environ['GYP_GENERATORS'] = 'ninja' | 447 os.environ['GYP_GENERATORS'] = 'ninja' |
| 440 | 448 |
| 441 # If on windows, and the automatic toolchain has been installed by | 449 # If on Windows, request that depot_tools install/update the automatic |
| 442 # depot_tools, then use it. | 450 # toolchain, and then use it (unless opted-out). |
| 443 vs2013_runtime_dll_dirs = None | 451 vs2013_runtime_dll_dirs = None |
| 444 # If MSVS_VERSION is explicitly specified to be something other than 2013, | 452 depot_tools_win_toolchain = \ |
| 445 # don't use the automatic toolchain, as it currently only supports VS2013. | 453 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) |
| 446 msvs_version = os.environ.get('GYP_MSVS_VERSION', '2013') | 454 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain: |
| 447 if sys.platform in ('win32', 'cygwin') and msvs_version.startswith('2013'): | |
| 448 import find_depot_tools | 455 import find_depot_tools |
| 449 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | 456 depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
| 457 get_toolchain_args = [ | |
| 458 sys.executable, | |
| 459 os.path.join(depot_tools_path, | |
| 460 'win_toolchain', | |
| 461 'get_toolchain_if_necessary.py'), | |
| 462 ] | |
| 463 get_toolchain_args.extend(GetDesiredVsToolchainHashes()) | |
|
iannucci
2014/02/21 23:56:14
the + operator works too :P
scottmg
2014/02/22 00:10:43
maruel always asks for + -> extend/append. Geez, C
| |
| 464 subprocess.check_call(get_toolchain_args) | |
| 465 | |
| 466 # TODO(scottmg): This should point at vs2013_files/<sha1> so that we can | |
| 467 # have multiple versions concurrently. This is slightly complicated at the | |
| 468 # moment because the downloader script doesn't know the SHA1 of the | |
| 469 # toolchain that it's downloading, so only supports having one 'installed' | |
| 470 # at a time. | |
|
iannucci
2014/02/21 23:56:14
We should probably have the depot tools thing prin
scottmg
2014/02/22 00:10:43
This seems better, except it's a somewhat long pro
| |
| 450 toolchain = os.path.normpath(os.path.join( | 471 toolchain = os.path.normpath(os.path.join( |
| 451 depot_tools_path, 'win_toolchain', 'vs2013_files')) | 472 depot_tools_path, 'win_toolchain', 'vs2013_files')) |
| 452 version_file = os.path.join(toolchain, '.version') | 473 version_file = os.path.join(toolchain, '.version') |
| 453 if os.path.isdir(toolchain) and os.path.isfile(version_file): | 474 if os.path.isdir(toolchain) and os.path.isfile(version_file): |
| 454 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain | 475 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain |
| 455 with open(version_file, 'r') as f: | 476 with open(version_file, 'r') as f: |
| 456 version_is_pro = f.read().strip() == 'pro' | 477 version_is_pro = f.read().strip() == 'pro' |
| 457 vs2013_runtime_dll_dirs = (os.path.join(toolchain, 'sys32'), | 478 vs2013_runtime_dll_dirs = (os.path.join(toolchain, 'sys32'), |
| 458 os.path.join(toolchain, 'sys64')) | 479 os.path.join(toolchain, 'sys64')) |
| 459 os.environ['GYP_MSVS_VERSION'] = '2013' if version_is_pro else '2013e' | 480 os.environ['GYP_MSVS_VERSION'] = '2013' if version_is_pro else '2013e' |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 # from above are picked up. | 531 # from above are picked up. |
| 511 print 'Running build/landmines.py...' | 532 print 'Running build/landmines.py...' |
| 512 subprocess.check_call( | 533 subprocess.check_call( |
| 513 [sys.executable, os.path.join(script_dir, 'landmines.py')]) | 534 [sys.executable, os.path.join(script_dir, 'landmines.py')]) |
| 514 | 535 |
| 515 if vs2013_runtime_dll_dirs: | 536 if vs2013_runtime_dll_dirs: |
| 516 CopyVsRuntimeDlls(os.path.join(chrome_src, GetOutputDirectory()), | 537 CopyVsRuntimeDlls(os.path.join(chrome_src, GetOutputDirectory()), |
| 517 vs2013_runtime_dll_dirs) | 538 vs2013_runtime_dll_dirs) |
| 518 | 539 |
| 519 sys.exit(gyp_rc) | 540 sys.exit(gyp_rc) |
| OLD | NEW |