Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1258)

Unified Diff: build/android/buildbot/bb_host_steps.py

Issue 15261003: Add a new script bb_host_steps.py which handles all host side steps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..87b14e8747cf560c74feedae076f854d50eb9a1c
--- /dev/null
+++ b/build/android/buildbot/bb_host_steps.py
@@ -0,0 +1,143 @@
+#!/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'
Isaac (away) 2013/06/05 03:03:07 remove this variable.
Siva Chandra 2013/06/05 21:04:28 Done.
+EXPERIMENTAL_TARGETS = ['android_experimental']
+
+# Short hand form RunCmd which is used extensively in this file.
+RunCmd = 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')
+ RunCmd(['android_webview/tools/webview_licenses.py', 'scan'],
+ retcode_callback=RetcodeCallback)
+
+
+def Compile(target, args, experimental=False):
+ cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'),
+ '--build-tool=ninja',
+ '--compiler=goma',
+ '--target=%s' % target,
+ '--goma-dir=%s' % bb_utils.GOMA_DIR,]
Isaac (away) 2013/06/05 03:03:07 trailing comma
Siva Chandra 2013/06/05 21:04:28 Done.
+ if experimental:
+ for compile_target in args:
+ buildbot_report.PrintNamedStep('Experimental Compile %s' % compile_target)
+ RunCmd(['gclient', 'runhooks'], flunk_on_failure=False)
+ RunCmd(cmd + ['--build-args=%s' % compile_target], flunk_on_failure=False)
+ else:
+ buildbot_report.PrintNamedStep('compile')
+ RunCmd(['gclient', 'runhooks'], halt_on_failure=True)
+ RunCmd(cmd + ['--build-args=%s' % ' '.join(args)], halt_on_failure=True)
+
+
+def ZipBuild(factory_properties, build_properties):
+ buildbot_report.PrintNamedStep('Zip build')
+ RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'),
+ '--src-dir', constants.CHROME_DIR,
+ '--build-dir', 'out',
+ '--exclude-files', EXCLUDE_FILES,
+ '--factory-properties', json.dumps(factory_properties),
+ '--build-properties', json.dumps(build_properties)])
+
+
+def ExtractBuild(factory_properties, build_properties):
+ buildbot_report.PrintNamedStep('Download and extract build')
+ RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'),
+ '--build-dir', os.path.join(constants.CHROME_DIR, 'build'),
+ '--build-output-dir', os.path.join(constants.CHROME_DIR, 'out'),
+ '--factory-properties', json.dumps(factory_properties),
+ '--build-properties', json.dumps(build_properties)],
+ retcode_callback=RetcodeCallback)
+
+
+def FindBugs(target):
+ buildbot_report.PrintNamedStep('findbugs')
+ if target == 'Release':
+ target = '--release-build'
+ RunCmd(['build/android/findbugs_diff.py', target])
+ RunCmd(['tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py',
+ target])
+
+
+def AsanTestsSetup():
Isaac (away) 2013/06/05 03:03:07 How about 'UpdateClang()'?
Siva Chandra 2013/06/05 21:04:28 Done.
+ RunCmd([os.path.join(constants.CHROME_DIR, 'tools', 'clang', 'scripts',
+ 'update.sh')])
+
+
+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.asan_tests_setup:
+ AsanTestsSetup()
+ if options.extract_build:
+ ExtractBuild(options.factory_properties, options.build_properties)
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698