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

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: 'Environment setup' is not a step 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..b26e65eba22bf36d7ffe0a5cc1e127bc76bd5a97
--- /dev/null
+++ b/build/android/buildbot/bb_host_steps.py
@@ -0,0 +1,132 @@
+#!/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 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(['gclient', 'runhooks'], flunk_on_failure=False)
Isaac (away) 2013/06/06 21:26:46 gclient runhooks should be called only once.
Siva Chandra 2013/06/06 22:10:47 bash did this. Changed now with the new runhooks s
+ 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', 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)
Isaac (away) 2013/06/06 21:26:46 the warning code for this is 88, which is the defa
Siva Chandra 2013/06/06 22:10:47 Is there any code which relies on the fact that de
Isaac (away) 2013/06/06 23:32:01 I don't know what you mean, but warning_code=1 her
+
+
+def FindBugs(target):
Isaac (away) 2013/06/06 21:26:46 why does this take a target? Doesn't seem like it
Siva Chandra 2013/06/06 22:10:47 the bash function depended on the env variable BUI
+ buildbot_report.PrintNamedStep('findbugs')
+ if target == 'Release':
+ target = '--release-build'
+ RunCmd([SrcPath('build', 'android', 'findbugs_diff.py'), target])
+ RunCmd([SrcPath('tools', 'android', 'findbugs_plugin', 'test',
+ 'run_findbugs_plugin_tests.py'),
+ 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',
+ 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 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')
+
+ if options.compile:
+ if 'check_webview_licenses' in host_tests:
+ CheckWebViewLicenses()
Isaac (away) 2013/06/06 21:26:46 Let's make a "runhooks" step which calls gclient r
Siva Chandra 2013/06/06 22:10:47 Done.
+ 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