| 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 override_gsutil = [sys.executable, options.gsutil_py_path] | 104 # Needs to add '--', otherwise gsutil options will be passed to gsutil.py. |
| 105 goma_utils.UploadGomaCompilerProxyInfo(override_gsutil=override_gsutil) | 105 override_gsutil = [sys.executable, options.gsutil_py_path, '--'] |
| 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) |
| 106 | 111 |
| 107 # Upload GomaStats to make it monitored. | 112 # Upload GomaStats to make it monitored. |
| 108 if env.get('GOMA_DUMP_STATS_FILE'): | 113 if env.get('GOMA_DUMP_STATS_FILE'): |
| 109 goma_utils.SendGomaStats(env['GOMA_DUMP_STATS_FILE'], | 114 goma_utils.SendGomaStats(env['GOMA_DUMP_STATS_FILE'], |
| 110 env.get('GOMACTL_CRASH_REPORT_ID_FILE'), | 115 env.get('GOMACTL_CRASH_REPORT_ID_FILE'), |
| 111 options.build_data_dir) | 116 options.build_data_dir) |
| 112 | 117 |
| 113 # TODO(tikuta): move to goma_utils.py | 118 # TODO(tikuta): move to goma_utils.py |
| 114 def goma_setup(options, env): | 119 def goma_setup(options, env): |
| 115 """Sets up goma if necessary. | 120 """Sets up goma if necessary. |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 print 'Failing build because ninja reported work to do.' | 429 print 'Failing build because ninja reported work to do.' |
| 425 print 'This means that after completing a compile, another was run and' | 430 print 'This means that after completing a compile, another was run and' |
| 426 print 'it resulted in still having work to do (that is, a no-op build' | 431 print 'it resulted in still having work to do (that is, a no-op build' |
| 427 print 'wasn\'t a no-op). Consult the first "ninja explain:" line for a' | 432 print 'wasn\'t a no-op). Consult the first "ninja explain:" line for a' |
| 428 print 'likely culprit.' | 433 print 'likely culprit.' |
| 429 return 1 | 434 return 1 |
| 430 return exit_status | 435 return exit_status |
| 431 finally: | 436 finally: |
| 432 override_gsutil = None | 437 override_gsutil = None |
| 433 if options.gsutil_py_path: | 438 if options.gsutil_py_path: |
| 434 override_gsutil = [sys.executable, options.gsutil_py_path] | 439 # Needs to add '--', otherwise gsutil options will be passed to gsutil.py. |
| 440 override_gsutil = [sys.executable, options.gsutil_py_path, '--'] |
| 435 | 441 |
| 436 goma_utils.UploadNinjaLog( | 442 goma_utils.UploadNinjaLog( |
| 437 options.target_output_dir, options.compiler, command, exit_status, | 443 options.target_output_dir, options.compiler, command, exit_status, |
| 438 override_gsutil=override_gsutil) | 444 override_gsutil=override_gsutil) |
| 439 | 445 |
| 440 | 446 |
| 441 def get_target_build_dir(options): | 447 def get_target_build_dir(options): |
| 442 """Keep this function in sync with src/build/landmines.py""" | 448 """Keep this function in sync with src/build/landmines.py""" |
| 443 if chromium_utils.IsLinux() and options.cros_board: | 449 if chromium_utils.IsLinux() and options.cros_board: |
| 444 # When building ChromeOS's Simple Chrome workflow, the output directory | 450 # When building ChromeOS's Simple Chrome workflow, the output directory |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 option_parser.add_option('--goma-fail-fast', action='store_true') | 499 option_parser.add_option('--goma-fail-fast', action='store_true') |
| 494 option_parser.add_option('--goma-disable-local-fallback', action='store_true') | 500 option_parser.add_option('--goma-disable-local-fallback', action='store_true') |
| 495 option_parser.add_option('--goma-jsonstatus', | 501 option_parser.add_option('--goma-jsonstatus', |
| 496 help='Specify a file to dump goma_ctl jsonstatus.') | 502 help='Specify a file to dump goma_ctl jsonstatus.') |
| 497 option_parser.add_option('--goma-service-account-json-file', | 503 option_parser.add_option('--goma-service-account-json-file', |
| 498 help='Specify a file containing goma service account' | 504 help='Specify a file containing goma service account' |
| 499 ' credentials') | 505 ' credentials') |
| 500 option_parser.add_option('--goma-jobs', default=None, | 506 option_parser.add_option('--goma-jobs', default=None, |
| 501 help='The number of jobs for ninja -j.') | 507 help='The number of jobs for ninja -j.') |
| 502 option_parser.add_option('--gsutil-py-path', | 508 option_parser.add_option('--gsutil-py-path', |
| 503 help='Specify path to gsutil.py script.') | 509 help='Specify path to gsutil.py script ' |
| 510 'in depot_tools.') |
| 504 option_parser.add_option('--ninja-path', default='ninja', | 511 option_parser.add_option('--ninja-path', default='ninja', |
| 505 help='Specify path to the ninja tool.') | 512 help='Specify path to the ninja tool.') |
| 506 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', | 513 option_parser.add_option('--ninja-ensure-up-to-date', action='store_true', |
| 507 help='Checks the output of the ninja builder to ' | 514 help='Checks the output of the ninja builder to ' |
| 508 'confirm that a second compile immediately ' | 515 'confirm that a second compile immediately ' |
| 509 'the first is a no-op.') | 516 'the first is a no-op.') |
| 510 option_parser.add_option('--cloudtail-pid-file', default=None, | 517 option_parser.add_option('--cloudtail-pid-file', default=None, |
| 511 help='Specify a file to store pid of cloudtail') | 518 help='Specify a file to store pid of cloudtail') |
| 512 | 519 |
| 513 # Arguments to pass buildbot properties. | 520 # Arguments to pass buildbot properties. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 exit_status = main_ninja(options, args, env) | 557 exit_status = main_ninja(options, args, env) |
| 551 | 558 |
| 552 # stop goma | 559 # stop goma |
| 553 goma_teardown(options, env, exit_status, goma_cloudtail) | 560 goma_teardown(options, env, exit_status, goma_cloudtail) |
| 554 | 561 |
| 555 return exit_status | 562 return exit_status |
| 556 | 563 |
| 557 | 564 |
| 558 if '__main__' == __name__: | 565 if '__main__' == __name__: |
| 559 sys.exit(real_main()) | 566 sys.exit(real_main()) |
| OLD | NEW |