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

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: Patch set for initial review Created 7 years, 7 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..02cf78b3ed7b963f107c4c32a160b2b0bb74bf29
--- /dev/null
+++ b/build/android/buildbot/bb_host_steps.py
@@ -0,0 +1,123 @@
+#!/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 optparse
+import os
+import sys
+
+from bb_utils import ConvertJson
+from bb_utils import OptParserError
+from bb_utils import RunCmd
+
+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(constants.BB_BUILD_DIR, 'scripts', 'slave')
+COMPILE_SCRIPT = os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py')
+ZIP_BUILD_SCRIPT = os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py')
+WEBVIEW_LICENSES_SCRIPT = 'android_webview/tools/webview_licenses.py'
+FINDBUGS_DIFF_SCRIPT = 'build/android/findbugs_diff.py'
+FINDBUGS_PLUGIN_TESTS_SCRIPT = (
+ 'tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py')
+
+VALID_HOST_STEPS = set(['check_webview_licenses',
+ 'compile',
+ 'compile_experimental',
+ 'findbugs',
+ 'zip_build'])
+
+BUILD_DIR = 'out'
+BUILD_TOOL = 'ninja'
+COMPILER = 'goma'
Isaac (away) 2013/05/29 20:28:07 remove variables on lines 21-26, 34-36 and add the
Siva Chandra 2013/06/04 00:34:03 Done.
+EXCLUDE_FILES = 'lib.target,gen,android_webview,jingle_unittests'
+EXPERIMENTAL_TARGETS = ['android_experimental']
+
+
+def CheckWebViewLicensesStep():
+ buildbot_report.PrintNamedStep('Check licenses for WebView')
+ def RetcodeCallback(code):
+ if code == 1:
+ buildbot_report.PrintWarning()
+ if code > 1:
+ buildbot_report.PrintError()
+ RunCmd([WEBVIEW_LICENSES_SCRIPT, 'scan'], retcode_callback=RetcodeCallback)
+
+
+def CompileStep(target, args, experimental=False):
+ opts = ['--build-tool=%s' % BUILD_TOOL,
+ '--compiler=%s' % COMPILER,
+ '--target=%s' % target,
+ '--goma-dir=%s' % constants.GOMA_DIR,]
+ if experimental:
+ for compile_target in args:
+ buildbot_report.PrintNamedStep('Exerimental Compile %s' % compile_target)
+ RunCmd([COMPILE_SCRIPT] + opts + ['--build-args=%s' % compile_target],
+ flunk_on_failure=False)
+ else:
+ buildbot_report.PrintNamedStep('compile')
+ RunCmd([COMPILE_SCRIPT] + opts + ['--build-args=%s' % ' '.join(args)])
+
+
+def ZipBuildStep(factory_properties, build_properties):
+ buildbot_report.PrintNamedStep('Zip build')
+ args = ['--src-dir', constants.CHROME_DIR,
+ '--build-dir', BUILD_DIR,
+ '--exclude-files', EXCLUDE_FILES,
+ '--factory-properties', factory_properties,
+ '--build-properties', build_properties]
+ RunCmd([ZIP_BUILD_SCRIPT] + args)
+
+
+def FindBugsStep(target):
+ buildbot_report.PrintNamedStep('findbugs')
+ if target == 'Release':
+ target = '--release-build'
+ RunCmd([FINDBUGS_DIFF_SCRIPT, target])
+ RunCmd([FINDBUGS_PLUGIN_TESTS_SCRIPT, target])
+
+
+def main(argv):
+ buildbot_report.PrintNamedStep('Host Steps')
+ parser = optparse.OptionParser()
+ parser.add_option('--steps', default='compile,zip_build',
+ help='Comma separated list of host steps.')
+ parser.add_option('--build-args', default='All',
+ help='Comma separated list of build targets.')
+ parser.add_option('--factory-properties', action='callback',
+ callback=ConvertJson, type='string', default={},
+ help='factory properties in JSON format.')
+ parser.add_option('--build-properties', action='callback',
+ callback=ConvertJson, type='string', default={},
+ help='build properties in JSON format.')
+
+ options, args = parser.parse_args(argv[1:])
+ if args:
+ return OptParserError(parser, 'Unused args %s' % args)
+
+ steps = options.steps.split(',')
+ unknown_steps = set(steps) - VALID_HOST_STEPS
+ if unknown_steps:
+ return OptParserError(parser, 'Unknown steps %s' % list(unknown_steps))
+
+ target = options.factory_properties.get('target', 'Debug')
+ for step in steps:
+ if step == 'check_webview_licenses':
Isaac (away) 2013/05/29 20:28:07 can we make check_webview_licenses and findbugs a
Siva Chandra 2013/06/04 00:34:03 Done.
+ CheckWebViewLicensesStep()
+ if step == 'compile':
Isaac (away) 2013/05/29 20:28:07 don't we always want to compile?
Siva Chandra 2013/06/04 00:34:03 Done. Compile comes from a boolean option now.
+ CompileStep(target, options.build_args.split(','))
+ if step == 'compile_experimental':
Isaac (away) 2013/05/29 20:28:07 add option --experimental instead of separate step
Siva Chandra 2013/06/04 00:34:03 Done.
+ CompileStep(target, EXPERIMENTAL_TARGETS, True)
+ if step == 'findbugs':
+ FindBugsStep(target)
+ if step == 'zip_build':
Isaac (away) 2013/05/29 20:28:07 add '--zip-build' option
Siva Chandra 2013/06/04 00:34:03 Done.
+ ZipBuildStep(json.dumps(options.factory_properties),
+ json.dumps(options.build_properties))
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))

Powered by Google App Engine
This is Rietveld 408576698