Index: build/android/buildbot/bb_host_steps.py |
diff --git a/build/android/buildbot/bb_host_steps.py b/build/android/buildbot/bb_host_steps.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..c0fb41a6ac6a29a926e9ad63b3798daf9cbe57ae |
--- /dev/null |
+++ b/build/android/buildbot/bb_host_steps.py |
@@ -0,0 +1,149 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import json |
+import os |
+import sys |
+ |
+import bb_utils |
+ |
+sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
+from pylib import buildbot_report |
+from pylib import constants |
+ |
+ |
+SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
+ |
+VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs']) |
+ |
+EXCLUDE_FILES = 'lib.target,gen,android_webview,jingle_unittests' |
+EXPERIMENTAL_TARGETS = ['android_experimental'] |
+ |
+# Short hand form RunCmd which is used extensively in this file. |
+R = bb_utils.RunCmd |
+ |
+ |
+def RetcodeCallback(code): |
+ if code == 1: |
+ # Step ends with a warning |
+ return 1, False, False |
+ if code > 1: |
+ # Step fails |
+ return 1, True, False |
+ return 0, True, False |
+ |
+ |
+def CheckWebViewLicenses(): |
+ buildbot_report.PrintNamedStep('Check licenses for WebView') |
+ webview_licenses_script = 'android_webview/tools/webview_licenses.py' |
Isaac (away)
2013/06/04 04:34:12
remove this var
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ R([webview_licenses_script, 'scan'], retcode_callback=RetcodeCallback) |
+ |
+ |
+def Compile(target, args, experimental=False): |
+ compile_script = os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py') |
+ opts = ['--build-tool=ninja', |
Isaac (away)
2013/06/04 04:34:12
change this var to 'cmd' and remove compile_script
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ '--compiler=goma', |
+ '--target=%s' % target, |
+ '--goma-dir=%s' % bb_utils.GOMA_DIR,] |
+ if experimental: |
+ for compile_target in args: |
+ buildbot_report.PrintNamedStep('Exerimental Compile %s' % compile_target) |
Isaac (away)
2013/06/04 04:34:12
Experimental
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ R(['gclient', 'runhooks'], flunk_on_failure=False) |
+ R([compile_script] + opts + ['--build-args=%s' % compile_target], |
+ flunk_on_failure=False) |
+ else: |
+ buildbot_report.PrintNamedStep('compile') |
+ R(['gclient', 'runhooks'], halt_on_failure=True) |
+ R([compile_script] + opts + ['--build-args=%s' % ' '.join(args)], |
+ halt_on_failure=True) |
+ |
+ |
+def ZipBuild(factory_properties, build_properties): |
+ buildbot_report.PrintNamedStep('Zip build') |
+ zip_build_script = os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py') |
Isaac (away)
2013/06/04 04:34:12
remove args and zip_build_script vars
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ args = ['--src-dir', constants.CHROME_DIR, |
+ '--build-dir', 'out', |
+ '--exclude-files', EXCLUDE_FILES, |
+ '--factory-properties', json.dumps(factory_properties), |
+ '--build-properties', json.dumps(build_properties)] |
+ R([zip_build_script] + args) |
+ |
+ |
+def ExtractBuild(factory_properties, build_properties): |
+ buildbot_report.PrintNamedStep('Download and extract build') |
+ extract_build_script = os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py') |
Isaac (away)
2013/06/04 04:34:12
remove these vars
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ args = ['--build-dir', os.path.join(constants.CHROME_DIR, 'build'), |
+ '--build-output-dir', '../out', |
Isaac (away)
2013/06/04 04:34:12
pass absolute directory
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ '--factoyr-properties', json.dumps(factory_properties), |
+ '--build-properties', json.dumps(build_properties)] |
+ R([extract_build_script] + args, retcode_callback=RetcodeCallback) |
+ |
+ |
+def FindBugs(target): |
+ buildbot_report.PrintNamedStep('findbugs') |
+ if target == 'Release': |
+ target = '--release-build' |
+ findbugs_diff_script = 'build/android/findbugs_diff.py' |
Isaac (away)
2013/06/04 04:34:12
remove these vars
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ findbugs_plugin_tests_script = ( |
+ 'tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py') |
+ R([findbugs_diff_script, target]) |
+ R([findbugs_plugin_tests_script, target]) |
+ |
+ |
+def AsanTestsSetup(): |
+ script = os.path.join(constants.CHROME_DIR, 'tools', 'clang', 'scripts', |
Isaac (away)
2013/06/04 04:34:12
don't make variable, just run directly.
Siva Chandra
2013/06/04 19:42:40
Done.
|
+ 'update.sh') |
+ R([script]) |
+ |
+ |
+def main(argv): |
+ buildbot_report.PrintNamedStep('Host Steps') |
+ |
+ parser = bb_utils.GetParser() |
+ parser.add_option('--host-tests', help='Comma separated list of host tests.') |
+ parser.add_option('--build-args', default='All', |
+ help='Comma separated list of build targets.') |
+ parser.add_option('--compile', action='store_true', |
+ help='Indicate whether a compile step should be run.') |
+ parser.add_option('--experimental', action='store_true', |
+ help='Indicate whether to compile experimental targets.') |
+ parser.add_option('--zipbuild', action='store_true', |
+ help='Indicate whether the build should be zipped.') |
+ parser.add_option('--extract-build', action='store_true', |
+ help='Indicate whether a build should be downloaded.') |
+ parser.add_option('--asan-tests-setup', action='store_true', |
+ help='Download or build the ASan runtime library.') |
+ |
+ options, args = parser.parse_args(argv[1:]) |
+ if args: |
+ return parser.Error('Unused args %s' % args) |
+ |
+ host_tests = [] |
+ if options.host_tests: |
+ host_tests = options.host_tests.split(',') |
+ unknown_tests = set(host_tests) - VALID_HOST_TESTS |
+ if unknown_tests: |
+ return parser.Error('Unknown host tests %s' % list(unknown_tests)) |
+ |
+ target = options.factory_properties.get('target', 'Debug') |
+ |
+ if options.compile: |
+ if 'check_webview_licenses' in host_tests: |
+ CheckWebViewLicenses() |
+ Compile(target, options.build_args.split(',')) |
+ if options.experimental: |
+ Compile(target, EXPERIMENTAL_TARGETS, True) |
+ if 'findbugs' in host_tests: |
+ FindBugs(target) |
+ if options.zipbuild: |
+ ZipBuild(options.factory_properties, options.build_properties) |
+ if options.extract_build: |
+ if options.asan_tests_setup: |
+ AsanTestsSetup() |
+ ExtractBuild(options.factory_properties, options.build_properties) |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main(sys.argv)) |