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

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: '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 unified diff | Download patch | Annotate | Revision Log
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.CHROME_DIR, *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 Compile(target, args, experimental=False):
36 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'),
37 '--build-tool=ninja',
38 '--compiler=goma',
39 '--target=%s' % target,
40 '--goma-dir=%s' % os.path.join(bb_utils.BB_BUILD_DIR, 'goma')]
41 if experimental:
42 for compile_target in args:
43 buildbot_report.PrintNamedStep('Experimental Compile %s' % compile_target)
44 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
45 RunCmd(cmd + ['--build-args=%s' % compile_target], flunk_on_failure=False)
46 else:
47 buildbot_report.PrintNamedStep('compile')
48 RunCmd(['gclient', 'runhooks'], halt_on_failure=True)
49 RunCmd(cmd + ['--build-args=%s' % ' '.join(args)], halt_on_failure=True)
50
51
52 def ZipBuild(factory_properties, build_properties):
53 buildbot_report.PrintNamedStep('Zip build')
54 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'),
55 '--src-dir', constants.CHROME_DIR,
56 '--build-dir', SrcPath('out'),
57 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests',
58 '--factory-properties', json.dumps(factory_properties),
59 '--build-properties', json.dumps(build_properties)])
60
61
62 def ExtractBuild(factory_properties, build_properties):
63 buildbot_report.PrintNamedStep('Download and extract build')
64 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'),
65 '--build-dir', SrcPath('build'),
66 '--build-output-dir', SrcPath('out'),
67 '--factory-properties', json.dumps(factory_properties),
68 '--build-properties', json.dumps(build_properties)],
69 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
70
71
72 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
73 buildbot_report.PrintNamedStep('findbugs')
74 if target == 'Release':
75 target = '--release-build'
76 RunCmd([SrcPath('build', 'android', 'findbugs_diff.py'), target])
77 RunCmd([SrcPath('tools', 'android', 'findbugs_plugin', 'test',
78 'run_findbugs_plugin_tests.py'),
79 target])
80
81
82 def UpdateClang():
83 RunCmd([SrcPath('tools', 'clang', 'scripts', 'update.sh')])
84
85
86 def main(argv):
87 parser = bb_utils.GetParser()
88 parser.add_option('--host-tests', help='Comma separated list of host tests.')
89 parser.add_option('--build-args', default='All',
90 help='Comma separated list of build targets.')
91 parser.add_option('--compile', action='store_true',
92 help='Indicate whether a compile step should be run.')
93 parser.add_option('--experimental', action='store_true',
94 help='Indicate whether to compile experimental targets.')
95 parser.add_option('--zipbuild', action='store_true',
96 help='Indicate whether the build should be zipped.')
97 parser.add_option('--extract-build', action='store_true',
98 help='Indicate whether a build should be downloaded.')
99 parser.add_option('--asan-tests-setup', action='store_true',
100 help='Download or build the ASan runtime library.')
101
102 options, args = parser.parse_args(argv[1:])
103 if args:
104 return sys.exit('Unused args %s' % args)
105
106 host_tests = []
107 if options.host_tests:
108 host_tests = options.host_tests.split(',')
109 unknown_tests = set(host_tests) - VALID_HOST_TESTS
110 if unknown_tests:
111 return sys.exit('Unknown host tests %s' % list(unknown_tests))
112
113 target = options.factory_properties.get('target', 'Debug')
114
115 if options.compile:
116 if 'check_webview_licenses' in host_tests:
117 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.
118 Compile(target, options.build_args.split(','))
119 if options.experimental:
120 Compile(target, EXPERIMENTAL_TARGETS, True)
121 if 'findbugs' in host_tests:
122 FindBugs(target)
123 if options.zipbuild:
124 ZipBuild(options.factory_properties, options.build_properties)
125 if options.asan_tests_setup:
126 UpdateClang()
127 if options.extract_build:
128 ExtractBuild(options.factory_properties, options.build_properties)
129
130
131 if __name__ == '__main__':
132 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698