| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 import bb_utils | 9 import bb_utils |
| 10 import bb_annotations |
| 10 | 11 |
| 11 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 12 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
| 12 from pylib import buildbot_report | |
| 13 from pylib import constants | 13 from pylib import constants |
| 14 | 14 |
| 15 | 15 |
| 16 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | 16 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
| 17 VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs']) | 17 VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs']) |
| 18 EXPERIMENTAL_TARGETS = ['android_experimental'] | 18 EXPERIMENTAL_TARGETS = ['android_experimental'] |
| 19 | 19 |
| 20 # Short hand for RunCmd which is used extensively in this file. | 20 # Short hand for RunCmd which is used extensively in this file. |
| 21 RunCmd = bb_utils.RunCmd | 21 RunCmd = bb_utils.RunCmd |
| 22 | 22 |
| 23 | 23 |
| 24 def SrcPath(*path): | 24 def SrcPath(*path): |
| 25 return os.path.join(constants.DIR_SOURCE_ROOT, *path) | 25 return os.path.join(constants.DIR_SOURCE_ROOT, *path) |
| 26 | 26 |
| 27 | 27 |
| 28 def CheckWebViewLicenses(_): | 28 def CheckWebViewLicenses(_): |
| 29 buildbot_report.PrintNamedStep('check_licenses') | 29 bb_annotations.PrintNamedStep('check_licenses') |
| 30 RunCmd([SrcPath('android_webview', 'tools', 'webview_licenses.py'), 'scan'], | 30 RunCmd([SrcPath('android_webview', 'tools', 'webview_licenses.py'), 'scan'], |
| 31 warning_code=1) | 31 warning_code=1) |
| 32 | 32 |
| 33 | 33 |
| 34 def RunHooks(build_type): | 34 def RunHooks(build_type): |
| 35 RunCmd([SrcPath('build', 'landmines.py')]) | 35 RunCmd([SrcPath('build', 'landmines.py')]) |
| 36 build_path = SrcPath('out', build_type) | 36 build_path = SrcPath('out', build_type) |
| 37 landmine_path = os.path.join(build_path, '.landmines_triggered') | 37 landmine_path = os.path.join(build_path, '.landmines_triggered') |
| 38 clobber_env = os.environ.get('BUILDBOT_CLOBBER') | 38 clobber_env = os.environ.get('BUILDBOT_CLOBBER') |
| 39 if clobber_env or os.path.isfile(landmine_path): | 39 if clobber_env or os.path.isfile(landmine_path): |
| 40 buildbot_report.PrintNamedStep('Clobber') | 40 bb_annotations.PrintNamedStep('Clobber') |
| 41 if not clobber_env: | 41 if not clobber_env: |
| 42 print 'Clobbering due to triggered landmines:' | 42 print 'Clobbering due to triggered landmines:' |
| 43 with open(landmine_path) as f: | 43 with open(landmine_path) as f: |
| 44 print f.read() | 44 print f.read() |
| 45 RunCmd(['rm', '-rf', build_path]) | 45 RunCmd(['rm', '-rf', build_path]) |
| 46 | 46 |
| 47 buildbot_report.PrintNamedStep('runhooks') | 47 bb_annotations.PrintNamedStep('runhooks') |
| 48 RunCmd(['gclient', 'runhooks'], halt_on_failure=True) | 48 RunCmd(['gclient', 'runhooks'], halt_on_failure=True) |
| 49 | 49 |
| 50 | 50 |
| 51 def Compile(options): | 51 def Compile(options): |
| 52 RunHooks(options.target) | 52 RunHooks(options.target) |
| 53 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), | 53 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), |
| 54 '--build-tool=ninja', | 54 '--build-tool=ninja', |
| 55 '--compiler=goma', | 55 '--compiler=goma', |
| 56 '--target=%s' % options.target, | 56 '--target=%s' % options.target, |
| 57 '--goma-dir=%s' % bb_utils.GOMA_DIR] | 57 '--goma-dir=%s' % bb_utils.GOMA_DIR] |
| 58 build_targets = options.build_targets.split(',') | 58 build_targets = options.build_targets.split(',') |
| 59 buildbot_report.PrintNamedStep('compile') | 59 bb_annotations.PrintNamedStep('compile') |
| 60 for build_target in build_targets: | 60 for build_target in build_targets: |
| 61 RunCmd(cmd + ['--build-args=%s' % build_target], halt_on_failure=True) | 61 RunCmd(cmd + ['--build-args=%s' % build_target], halt_on_failure=True) |
| 62 if options.experimental: | 62 if options.experimental: |
| 63 for compile_target in EXPERIMENTAL_TARGETS: | 63 for compile_target in EXPERIMENTAL_TARGETS: |
| 64 buildbot_report.PrintNamedStep('Experimental Compile %s' % compile_target) | 64 bb_annotations.PrintNamedStep('Experimental Compile %s' % compile_target) |
| 65 RunCmd(cmd + ['--build-args=%s' % compile_target], flunk_on_failure=False) | 65 RunCmd(cmd + ['--build-args=%s' % compile_target], flunk_on_failure=False) |
| 66 | 66 |
| 67 | 67 |
| 68 def ZipBuild(options): | 68 def ZipBuild(options): |
| 69 buildbot_report.PrintNamedStep('zip_build') | 69 bb_annotations.PrintNamedStep('zip_build') |
| 70 RunCmd([ | 70 RunCmd([ |
| 71 os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'), | 71 os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'), |
| 72 '--src-dir', constants.DIR_SOURCE_ROOT, | 72 '--src-dir', constants.DIR_SOURCE_ROOT, |
| 73 '--build-dir', SrcPath('out'), | 73 '--build-dir', SrcPath('out'), |
| 74 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests'] | 74 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests'] |
| 75 + bb_utils.EncodeProperties(options)) | 75 + bb_utils.EncodeProperties(options)) |
| 76 | 76 |
| 77 | 77 |
| 78 def ExtractBuild(options): | 78 def ExtractBuild(options): |
| 79 buildbot_report.PrintNamedStep('extract_build') | 79 bb_annotations.PrintNamedStep('extract_build') |
| 80 RunCmd( | 80 RunCmd( |
| 81 [os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'), | 81 [os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'), |
| 82 '--build-dir', SrcPath('build'), '--build-output-dir', | 82 '--build-dir', SrcPath('build'), '--build-output-dir', |
| 83 SrcPath('out')] + bb_utils.EncodeProperties(options), | 83 SrcPath('out')] + bb_utils.EncodeProperties(options), |
| 84 warning_code=1) | 84 warning_code=1) |
| 85 | 85 |
| 86 | 86 |
| 87 def FindBugs(options): | 87 def FindBugs(options): |
| 88 buildbot_report.PrintNamedStep('findbugs') | 88 bb_annotations.PrintNamedStep('findbugs') |
| 89 build_type = [] | 89 build_type = [] |
| 90 if options.target == 'Release': | 90 if options.target == 'Release': |
| 91 build_type = ['--release-build'] | 91 build_type = ['--release-build'] |
| 92 RunCmd([SrcPath('build', 'android', 'findbugs_diff.py')] + build_type) | 92 RunCmd([SrcPath('build', 'android', 'findbugs_diff.py')] + build_type) |
| 93 RunCmd([SrcPath( | 93 RunCmd([SrcPath( |
| 94 'tools', 'android', 'findbugs_plugin', 'test', | 94 'tools', 'android', 'findbugs_plugin', 'test', |
| 95 'run_findbugs_plugin_tests.py')] + build_type) | 95 'run_findbugs_plugin_tests.py')] + build_type) |
| 96 | 96 |
| 97 | 97 |
| 98 def BisectPerfRegression(_): | 98 def BisectPerfRegression(_): |
| 99 buildbot_report.PrintNamedStep('Bisect Perf Regression') | 99 bb_annotations.PrintNamedStep('Bisect Perf Regression') |
| 100 RunCmd([SrcPath('tools', 'prepare-bisect-perf-regression.py'), | 100 RunCmd([SrcPath('tools', 'prepare-bisect-perf-regression.py'), |
| 101 '-w', os.path.join(constants.DIR_SOURCE_ROOT, os.pardir)]) | 101 '-w', os.path.join(constants.DIR_SOURCE_ROOT, os.pardir)]) |
| 102 RunCmd([SrcPath('tools', 'run-bisect-perf-regression.py'), | 102 RunCmd([SrcPath('tools', 'run-bisect-perf-regression.py'), |
| 103 '-w', os.path.join(constants.DIR_SOURCE_ROOT, os.pardir), | 103 '-w', os.path.join(constants.DIR_SOURCE_ROOT, os.pardir), |
| 104 '-p', bb_utils.GOMA_DIR]) | 104 '-p', bb_utils.GOMA_DIR]) |
| 105 | 105 |
| 106 | 106 |
| 107 def GetHostStepCmds(): | 107 def GetHostStepCmds(): |
| 108 return [ | 108 return [ |
| 109 ('compile', Compile), | 109 ('compile', Compile), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 133 return sys.exit('Unused args %s' % args) | 133 return sys.exit('Unused args %s' % args) |
| 134 | 134 |
| 135 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 135 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
| 136 | 136 |
| 137 if options.steps: | 137 if options.steps: |
| 138 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) | 138 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) |
| 139 | 139 |
| 140 | 140 |
| 141 if __name__ == '__main__': | 141 if __name__ == '__main__': |
| 142 sys.exit(main(sys.argv)) | 142 sys.exit(main(sys.argv)) |
| OLD | NEW |