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

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

Powered by Google App Engine
This is Rietveld 408576698