| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A tool to build chrome, executed by buildbot. | 6 """A tool to build chrome, executed by buildbot. |
| 7 | 7 |
| 8 When this is run, the current directory (cwd) should be the outer build | 8 When this is run, the current directory (cwd) should be the outer build |
| 9 directory (e.g., chrome-release/build/). | 9 directory (e.g., chrome-release/build/). |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 clobber=options.buildbot_clobber) | 94 clobber=options.buildbot_clobber) |
| 95 | 95 |
| 96 # If goma compiler_proxy crashes, there could be crash dump. | 96 # If goma compiler_proxy crashes, there could be crash dump. |
| 97 if options.build_data_dir: | 97 if options.build_data_dir: |
| 98 env['GOMACTL_CRASH_REPORT_ID_FILE'] = os.path.join(options.build_data_dir, | 98 env['GOMACTL_CRASH_REPORT_ID_FILE'] = os.path.join(options.build_data_dir, |
| 99 'crash_report_id_file') | 99 'crash_report_id_file') |
| 100 # We must stop the proxy to dump GomaStats. | 100 # We must stop the proxy to dump GomaStats. |
| 101 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) | 101 chromium_utils.RunCommand(goma_ctl_cmd + ['stop'], env=env) |
| 102 override_gsutil = None | 102 override_gsutil = None |
| 103 if options.gsutil_py_path: | 103 if options.gsutil_py_path: |
| 104 # Needs to add '--', otherwise gsutil options will be passed to gsutil.py. | 104 override_gsutil = [sys.executable, options.gsutil_py_path] |
| 105 override_gsutil = [sys.executable, options.gsutil_py_path, '--'] | 105 goma_utils.UploadGomaCompilerProxyInfo(override_gsutil=override_gsutil) |
| 106 goma_utils.UploadGomaCompilerProxyInfo(override_gsutil=override_gsutil, | |
| 107 builder=options.buildbot_buildername, | |
| 108 master=options.buildbot_mastername, | |
| 109 slave=options.buildbot_slavename, | |
| 110 clobber=options.buildbot_clobber) | |
| 111 | 106 |
| 112 # Upload GomaStats to make it monitored. | 107 # Upload GomaStats to make it monitored. |
| 113 if env.get('GOMA_DUMP_STATS_FILE'): | 108 if env.get('GOMA_DUMP_STATS_FILE'): |
| 114 goma_utils.SendGomaStats(env['GOMA_DUMP_STATS_FILE'], | 109 goma_utils.SendGomaStats(env['GOMA_DUMP_STATS_FILE'], |
| 115 env.get('GOMACTL_CRASH_REPORT_ID_FILE'), | 110 env.get('GOMACTL_CRASH_REPORT_ID_FILE'), |
| 116 options.build_data_dir) | 111 options.build_data_dir) |
| 117 | 112 |
| 118 # TODO(tikuta): move to goma_utils.py | 113 # TODO(tikuta): move to goma_utils.py |
| 119 def goma_setup(options, env): | 114 def goma_setup(options, env): |
| 120 """Sets up goma if necessary. | 115 """Sets up goma if necessary. |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 print 'Failing build because ninja reported work to do.' | 424 print 'Failing build because ninja reported work to do.' |
| 430 print 'This means that after completing a compile, another was run and' | 425 print 'This means that after completing a compile, another was run and' |
| 431 print 'it resulted in still having work to do (that is, a no-op build' | 426 print 'it resulted in still having work to do (that is, a no-op build' |
| 432 print 'wasn\'t a no-op). Consult the first "ninja explain:" line for a' | 427 print 'wasn\'t a no-op). Consult the first "ninja explain:" line for a' |
| 433 print 'likely culprit.' | 428 print 'likely culprit.' |
| 434 return 1 | 429 return 1 |
| 435 return exit_status | 430 return exit_status |
| 436 finally: | 431 finally: |
| 437 override_gsutil = None | 432 override_gsutil = None |
| 438 if options.gsutil_py_path: | 433 if options.gsutil_py_path: |
| 439 # Needs to add '--', otherwise gsutil options will be passed to gsutil.py. | 434 override_gsutil = [sys.executable, options.gsutil_py_path] |
| 440 override_gsutil = [sys.executable, options.gsutil_py_path, '--'] | |
| 441 | 435 |
| 442 goma_utils.UploadNinjaLog( | 436 goma_utils.UploadNinjaLog( |
| 443 options.target_output_dir, options.compiler, command, exit_status, | 437 options.target_output_dir, options.compiler, command, exit_status, |
| 444 override_gsutil=override_gsutil) | 438 override_gsutil=override_gsutil) |
| 445 | 439 |
| 446 | 440 |
| 447 def get_target_build_dir(options): | 441 def get_target_build_dir(options): |
| 448 """Keep this function in sync with src/build/landmines.py""" | 442 """Keep this function in sync with src/build/landmines.py""" |
| 449 if chromium_utils.IsLinux() and options.cros_board: | 443 if chromium_utils.IsLinux() and options.cros_board: |
| 450 # When building ChromeOS's Simple Chrome workflow, the output directory | 444 # When building ChromeOS's Simple Chrome workflow, the output directory |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 option_parser.add_option('--goma-fail-fast', action='store_true') | 493 option_parser.add_option('--goma-fail-fast', action='store_true') |
| 500 option_parser.add_option('--goma-disable-local-fallback', action='store_true') | 494 option_parser.add_option('--goma-disable-local-fallback', action='store_true') |
| 501 option_parser.add_option('--goma-jsonstatus', | 495 option_parser.add_option('--goma-jsonstatus', |
| 502 help='Specify a file to dump goma_ctl jsonstatus.') | 496 help='Specify a file to dump goma_ctl jsonstatus.') |
| 503 option_parser.add_option('--goma-service-account-json-file', | 497 option_parser.add_option('--goma-service-account-json-file', |
| 504 help='Specify a file containing goma service account' | 498 help='Specify a file containing goma service account' |
| 505 ' credentials') | 499 ' credentials') |
| 506 option_parser.add_option('--goma-jobs', default=None, | 500 option_parser.add_option('--goma-jobs', default=None, |
| 507 help='The number of jobs for ninja -j.') | 501 help='The number of jobs for ninja -j.') |
| 508 option_parser.add_option('--gsutil-py-path', | 502 option_parser.add_option('--gsutil-py-path', |
| 509 help='Specify path to gsutil.py script ' | 503 help='Specify path to gsutil.py script.') |
| 510 'in depot_tools.') | |
| 511 option_parser.add_option('--ninja-path', default='ninja', | 504 option_parser.add_option('--ninja-path', default='ninja', |
| 512 help='Specify path to the ninja tool.') | 505 help='Specify path to the ninja tool.') |
| 513 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', | 506 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', |
| 514 help='Checks the output of the ninja builder to ' | 507 help='Checks the output of the ninja builder to ' |
| 515 'confirm that a second compile immediately ' | 508 'confirm that a second compile immediately ' |
| 516 'the first is a no-op.') | 509 'the first is a no-op.') |
| 517 option_parser.add_option('--cloudtail-pid-file', default=None, | 510 option_parser.add_option('--cloudtail-pid-file', default=None, |
| 518 help='Specify a file to store pid of cloudtail') | 511 help='Specify a file to store pid of cloudtail') |
| 519 | 512 |
| 520 # Arguments to pass buildbot properties. | 513 # Arguments to pass buildbot properties. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 exit_status = main_ninja(options, args, env) | 550 exit_status = main_ninja(options, args, env) |
| 558 | 551 |
| 559 # stop goma | 552 # stop goma |
| 560 goma_teardown(options, env, exit_status, goma_cloudtail) | 553 goma_teardown(options, env, exit_status, goma_cloudtail) |
| 561 | 554 |
| 562 return exit_status | 555 return exit_status |
| 563 | 556 |
| 564 | 557 |
| 565 if '__main__' == __name__: | 558 if '__main__' == __name__: |
| 566 sys.exit(real_main()) | 559 sys.exit(real_main()) |
| OLD | NEW |