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

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: Wrap slave_properties with quotes 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..a945a96b795edafb7aaa2a30b788781aa92a8120
--- /dev/null
+++ b/build/android/buildbot/bb_host_steps.py
@@ -0,0 +1,136 @@
+#!/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'])
+EXPERIMENTAL_TARGETS = ['android_experimental']
+
+# Short hand for RunCmd which is used extensively in this file.
+RunCmd = bb_utils.RunCmd
+
+
+def SrcPath(*path):
+ return os.path.join(constants.CHROME_DIR, *path)
+
+
+def CheckWebViewLicenses():
+ buildbot_report.PrintNamedStep('Check licenses for WebView')
+ RunCmd([SrcPath('android_webview', 'tools', 'webview_licenses.py'), 'scan'],
+ warning_code=1)
+
+
+def RunHooks():
+ buildbot_report.PrintNamedStep('runhooks')
+ RunCmd(['gclient', 'runhooks'], halt_on_failure=True)
+
+
+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' % os.path.join(bb_utils.BB_BUILD_DIR, 'goma')]
+ if experimental:
+ for compile_target in args:
+ buildbot_report.PrintNamedStep('Experimental Compile %s' % compile_target)
+ RunCmd(cmd + ['--build-args=%s' % compile_target], flunk_on_failure=False)
+ else:
+ buildbot_report.PrintNamedStep('compile')
+ 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', SrcPath('out'),
+ '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests',
+ '--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', SrcPath('build'),
+ '--build-output-dir', SrcPath('out'),
+ '--factory-properties', json.dumps(factory_properties),
+ '--build-properties', json.dumps(build_properties)],
+ warning_code=1)
+
+
+def FindBugs(target):
Isaac (away) 2013/06/06 23:32:02 We should avoid passing around a string here. Con
Siva Chandra 2013/06/07 01:42:08 Done.
+ buildbot_report.PrintNamedStep('findbugs')
+ if target == 'Release':
+ target = '--release-build'
+ RunCmd([SrcPath('build', 'android', 'findbugs_diff.py'), target])
Isaac (away) 2013/06/06 23:32:02 we should not pass target arg if build type is deb
Siva Chandra 2013/06/07 01:42:08 Done.
+ RunCmd([SrcPath('tools', 'android', 'findbugs_plugin', 'test',
+ 'run_findbugs_plugin_tests.py'),
Isaac (away) 2013/06/06 23:32:02 nit linebreak
Siva Chandra 2013/06/07 01:42:08 The line is now different. Where do you suggested
Isaac (away) 2013/06/07 02:59:11 looks fine now. The comment was me thinking targe
+ target])
+
+
+def UpdateClang():
+ RunCmd([SrcPath('tools', 'clang', 'scripts', 'update.sh')])
+
+
+def main(argv):
+ parser = bb_utils.GetParser()
+ parser.add_option('--host-tests', help='Comma separated list of host tests.')
+ parser.add_option('--build-args', default='All',
Isaac (away) 2013/06/06 23:32:02 Is this option being used right now? If not, we s
Siva Chandra 2013/06/07 01:42:08 We will require it downstream.
Isaac (away) 2013/06/07 02:59:11 OK.
+ 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',
Isaac (away) 2013/06/06 23:32:02 --zip-build
Siva Chandra 2013/06/07 01:42:08 Done.
+ 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',
Isaac (away) 2013/06/06 23:32:02 --update-clang
Siva Chandra 2013/06/07 01:42:08 Done.
+ help='Download or build the ASan runtime library.')
+
+ options, args = parser.parse_args(argv[1:])
+ if args:
+ return sys.exit('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 sys.exit('Unknown host tests %s' % list(unknown_tests))
+
+ target = options.factory_properties.get('target', 'Debug')
Isaac (away) 2013/06/06 23:32:02 could you rename this per commend above? Perhaps
Siva Chandra 2013/06/07 01:42:08 Done.
+
+ if options.compile:
+ if 'check_webview_licenses' in host_tests:
+ CheckWebViewLicenses()
+ RunHooks()
+ 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:
+ UpdateClang()
+ 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