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

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: First Full CL 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
19 VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs'])
20
21 EXCLUDE_FILES = 'lib.target,gen,android_webview,jingle_unittests'
22 EXPERIMENTAL_TARGETS = ['android_experimental']
23
24 # Short hand form RunCmd which is used extensively in this file.
25 R = bb_utils.RunCmd
26
27
28 def RetcodeCallback(code):
29 if code == 1:
30 # Step ends with a warning
31 return 1, False, False
32 if code > 1:
33 # Step fails
34 return 1, True, False
35 return 0, True, False
36
37
38 def CheckWebViewLicenses():
39 buildbot_report.PrintNamedStep('Check licenses for WebView')
40 webview_licenses_script = 'android_webview/tools/webview_licenses.py'
Isaac (away) 2013/06/04 04:34:12 remove this var
Siva Chandra 2013/06/04 19:42:40 Done.
41 R([webview_licenses_script, 'scan'], retcode_callback=RetcodeCallback)
42
43
44 def Compile(target, args, experimental=False):
45 compile_script = os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py')
46 opts = ['--build-tool=ninja',
Isaac (away) 2013/06/04 04:34:12 change this var to 'cmd' and remove compile_script
Siva Chandra 2013/06/04 19:42:40 Done.
47 '--compiler=goma',
48 '--target=%s' % target,
49 '--goma-dir=%s' % bb_utils.GOMA_DIR,]
50 if experimental:
51 for compile_target in args:
52 buildbot_report.PrintNamedStep('Exerimental Compile %s' % compile_target)
Isaac (away) 2013/06/04 04:34:12 Experimental
Siva Chandra 2013/06/04 19:42:40 Done.
53 R(['gclient', 'runhooks'], flunk_on_failure=False)
54 R([compile_script] + opts + ['--build-args=%s' % compile_target],
55 flunk_on_failure=False)
56 else:
57 buildbot_report.PrintNamedStep('compile')
58 R(['gclient', 'runhooks'], halt_on_failure=True)
59 R([compile_script] + opts + ['--build-args=%s' % ' '.join(args)],
60 halt_on_failure=True)
61
62
63 def ZipBuild(factory_properties, build_properties):
64 buildbot_report.PrintNamedStep('Zip build')
65 zip_build_script = os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py')
Isaac (away) 2013/06/04 04:34:12 remove args and zip_build_script vars
Siva Chandra 2013/06/04 19:42:40 Done.
66 args = ['--src-dir', constants.CHROME_DIR,
67 '--build-dir', 'out',
68 '--exclude-files', EXCLUDE_FILES,
69 '--factory-properties', json.dumps(factory_properties),
70 '--build-properties', json.dumps(build_properties)]
71 R([zip_build_script] + args)
72
73
74 def ExtractBuild(factory_properties, build_properties):
75 buildbot_report.PrintNamedStep('Download and extract build')
76 extract_build_script = os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py')
Isaac (away) 2013/06/04 04:34:12 remove these vars
Siva Chandra 2013/06/04 19:42:40 Done.
77 args = ['--build-dir', os.path.join(constants.CHROME_DIR, 'build'),
78 '--build-output-dir', '../out',
Isaac (away) 2013/06/04 04:34:12 pass absolute directory
Siva Chandra 2013/06/04 19:42:40 Done.
79 '--factoyr-properties', json.dumps(factory_properties),
80 '--build-properties', json.dumps(build_properties)]
81 R([extract_build_script] + args, retcode_callback=RetcodeCallback)
82
83
84 def FindBugs(target):
85 buildbot_report.PrintNamedStep('findbugs')
86 if target == 'Release':
87 target = '--release-build'
88 findbugs_diff_script = 'build/android/findbugs_diff.py'
Isaac (away) 2013/06/04 04:34:12 remove these vars
Siva Chandra 2013/06/04 19:42:40 Done.
89 findbugs_plugin_tests_script = (
90 'tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py')
91 R([findbugs_diff_script, target])
92 R([findbugs_plugin_tests_script, target])
93
94
95 def AsanTestsSetup():
96 script = os.path.join(constants.CHROME_DIR, 'tools', 'clang', 'scripts',
Isaac (away) 2013/06/04 04:34:12 don't make variable, just run directly.
Siva Chandra 2013/06/04 19:42:40 Done.
97 'update.sh')
98 R([script])
99
100
101 def main(argv):
102 buildbot_report.PrintNamedStep('Host Steps')
103
104 parser = bb_utils.GetParser()
105 parser.add_option('--host-tests', help='Comma separated list of host tests.')
106 parser.add_option('--build-args', default='All',
107 help='Comma separated list of build targets.')
108 parser.add_option('--compile', action='store_true',
109 help='Indicate whether a compile step should be run.')
110 parser.add_option('--experimental', action='store_true',
111 help='Indicate whether to compile experimental targets.')
112 parser.add_option('--zipbuild', action='store_true',
113 help='Indicate whether the build should be zipped.')
114 parser.add_option('--extract-build', action='store_true',
115 help='Indicate whether a build should be downloaded.')
116 parser.add_option('--asan-tests-setup', action='store_true',
117 help='Download or build the ASan runtime library.')
118
119 options, args = parser.parse_args(argv[1:])
120 if args:
121 return parser.Error('Unused args %s' % args)
122
123 host_tests = []
124 if options.host_tests:
125 host_tests = options.host_tests.split(',')
126 unknown_tests = set(host_tests) - VALID_HOST_TESTS
127 if unknown_tests:
128 return parser.Error('Unknown host tests %s' % list(unknown_tests))
129
130 target = options.factory_properties.get('target', 'Debug')
131
132 if options.compile:
133 if 'check_webview_licenses' in host_tests:
134 CheckWebViewLicenses()
135 Compile(target, options.build_args.split(','))
136 if options.experimental:
137 Compile(target, EXPERIMENTAL_TARGETS, True)
138 if 'findbugs' in host_tests:
139 FindBugs(target)
140 if options.zipbuild:
141 ZipBuild(options.factory_properties, options.build_properties)
142 if options.extract_build:
143 if options.asan_tests_setup:
144 AsanTestsSetup()
145 ExtractBuild(options.factory_properties, options.build_properties)
146
147
148 if __name__ == '__main__':
149 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698