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

Side by Side 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: yet another 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/buildbot/bb_device_steps.py ('k') | build/android/buildbot/bb_run_bot.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import json
7 import os
8 import sys
9
10 import bb_utils
11
12 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
13 from pylib import buildbot_report
14 from pylib import constants
15
16
17 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave')
18 VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs'])
19 EXPERIMENTAL_TARGETS = ['android_experimental']
20
21 # Short hand for RunCmd which is used extensively in this file.
22 RunCmd = bb_utils.RunCmd
23
24
25 def SrcPath(*path):
26 return os.path.join(constants.DIR_SOURCE_ROOT, *path)
27
28
29 def CheckWebViewLicenses():
30 buildbot_report.PrintNamedStep('Check licenses for WebView')
31 RunCmd([SrcPath('android_webview', 'tools', 'webview_licenses.py'), 'scan'],
32 warning_code=1)
33
34
35 def RunHooks():
36 buildbot_report.PrintNamedStep('runhooks')
37 RunCmd(['gclient', 'runhooks'], halt_on_failure=True)
38
39
40 def Compile(build_type, args, experimental=False):
41 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'),
42 '--build-tool=ninja',
43 '--compiler=goma',
44 '--target=%s' % build_type,
45 '--goma-dir=%s' % os.path.join(bb_utils.BB_BUILD_DIR, 'goma')]
46 if experimental:
47 for compile_target in args:
48 buildbot_report.PrintNamedStep('Experimental Compile %s' % compile_target)
49 RunCmd(cmd + ['--build-args=%s' % compile_target], flunk_on_failure=False)
50 else:
51 buildbot_report.PrintNamedStep('compile')
52 RunCmd(cmd + ['--build-args=%s' % ' '.join(args)], halt_on_failure=True)
53
54
55 def ZipBuild(factory_properties, build_properties):
56 buildbot_report.PrintNamedStep('Zip build')
57 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'),
58 '--src-dir', constants.DIR_SOURCE_ROOT,
59 '--build-dir', SrcPath('out'),
60 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests',
61 '--factory-properties', json.dumps(factory_properties),
62 '--build-properties', json.dumps(build_properties)])
63
64
65 def ExtractBuild(factory_properties, build_properties):
66 buildbot_report.PrintNamedStep('Download and extract build')
67 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'),
68 '--build-dir', SrcPath('build'),
69 '--build-output-dir', SrcPath('out'),
70 '--factory-properties', json.dumps(factory_properties),
71 '--build-properties', json.dumps(build_properties)],
72 warning_code=1)
73
74
75 def FindBugs(is_release):
76 buildbot_report.PrintNamedStep('findbugs')
77 build_type = []
78 if is_release:
79 build_type = ['--release-build']
80 RunCmd([SrcPath('build', 'android', 'findbugs_diff.py')] + build_type)
81 RunCmd([SrcPath(
82 'tools', 'android', 'findbugs_plugin', 'test',
83 'run_findbugs_plugin_tests.py')] + build_type)
84
85
86 def UpdateClang():
87 RunCmd([SrcPath('tools', 'clang', 'scripts', 'update.sh')])
88
89
90 def main(argv):
91 parser = bb_utils.GetParser()
92 parser.add_option('--host-tests', help='Comma separated list of host tests.')
93 parser.add_option('--build-args', default='All',
94 help='Comma separated list of build targets.')
95 parser.add_option('--compile', action='store_true',
96 help='Indicate whether a compile step should be run.')
97 parser.add_option('--experimental', action='store_true',
98 help='Indicate whether to compile experimental targets.')
99 parser.add_option('--zip-build', action='store_true',
100 help='Indicate whether the build should be zipped.')
101 parser.add_option('--extract-build', action='store_true',
102 help='Indicate whether a build should be downloaded.')
103 parser.add_option('--update-clang', action='store_true',
104 help='Download or build the ASan runtime library.')
105
106 options, args = parser.parse_args(argv[1:])
107 if args:
108 return sys.exit('Unused args %s' % args)
109
110 host_tests = []
111 if options.host_tests:
112 host_tests = options.host_tests.split(',')
113 unknown_tests = set(host_tests) - VALID_HOST_TESTS
114 if unknown_tests:
115 return sys.exit('Unknown host tests %s' % list(unknown_tests))
116
117 build_type = options.factory_properties.get('target', 'Debug')
118
119 if options.compile:
120 if 'check_webview_licenses' in host_tests:
121 CheckWebViewLicenses()
122 RunHooks()
123 Compile(build_type, options.build_args.split(','))
124 if options.experimental:
125 Compile(build_type, EXPERIMENTAL_TARGETS, True)
126 if 'findbugs' in host_tests:
127 FindBugs(build_type == 'Release')
128 if options.zip_build:
129 ZipBuild(options.factory_properties, options.build_properties)
130 if options.update_clang:
131 UpdateClang()
132 if options.extract_build:
133 ExtractBuild(options.factory_properties, options.build_properties)
134
135
136 if __name__ == '__main__':
137 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/buildbot/bb_device_steps.py ('k') | build/android/buildbot/bb_run_bot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698