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

Side by Side Diff: build/android/buildbot/bb_host_steps.py

Issue 2180023002: Remove src/build/android/buildbot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« 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 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 os
7 import json
8 import sys
9
10 import bb_utils
11 import bb_annotations
12
13 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
14 from pylib.constants import host_paths
15
16
17 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave')
18 VALID_HOST_TESTS = set(['check_webview_licenses'])
19
20 DIR_BUILD_ROOT = os.path.dirname(host_paths.DIR_SOURCE_ROOT)
21
22 # Short hand for RunCmd which is used extensively in this file.
23 RunCmd = bb_utils.RunCmd
24
25
26 def SrcPath(*path):
27 return os.path.join(host_paths.DIR_SOURCE_ROOT, *path)
28
29
30 def CheckWebViewLicenses(_):
31 bb_annotations.PrintNamedStep('check_licenses')
32 RunCmd([SrcPath('android_webview', 'tools', 'webview_licenses.py'), 'scan'],
33 warning_code=1)
34
35
36 def RunHooks(build_type):
37 RunCmd([SrcPath('build', 'landmines.py')])
38 build_path = SrcPath('out', build_type)
39 landmine_path = os.path.join(build_path, '.landmines_triggered')
40 clobber_env = os.environ.get('BUILDBOT_CLOBBER')
41 if clobber_env or os.path.isfile(landmine_path):
42 bb_annotations.PrintNamedStep('Clobber')
43 if not clobber_env:
44 print 'Clobbering due to triggered landmines:'
45 with open(landmine_path) as f:
46 print f.read()
47 RunCmd(['rm', '-rf', build_path])
48
49 bb_annotations.PrintNamedStep('runhooks')
50 RunCmd(['gclient', 'runhooks'], halt_on_failure=True)
51
52
53 def GenerateBuildFiles(options):
54 cmd = [SrcPath('tools', 'mb', 'mb.py'),
55 'gen',
56 '-m', options.build_properties['mastername'],
57 '-b', options.build_properties['buildername'],
58 '--goma-dir', bb_utils.GOMA_DIR,
59 '//out/%s' % options.target]
60 bb_annotations.PrintNamedStep('generate_build_files')
61 RunCmd(cmd, halt_on_failure=True)
62
63
64 def Compile(options):
65 if options.run_mb:
66 os.environ['GYP_CHROMIUM_NO_ACTION'] = '1'
67 RunHooks(options.target)
68 GenerateBuildFiles(options)
69 else:
70 RunHooks(options.target)
71
72 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'),
73 '--compiler=goma',
74 '--target=%s' % options.target,
75 '--goma-dir=%s' % bb_utils.GOMA_DIR]
76 bb_annotations.PrintNamedStep('compile')
77 if options.build_targets:
78 build_targets = options.build_targets.split(',')
79 cmd += ['--build-args', ' '.join(build_targets)]
80 RunCmd(cmd, halt_on_failure=True, cwd=DIR_BUILD_ROOT)
81
82
83 def ZipBuild(options):
84 bb_annotations.PrintNamedStep('zip_build')
85 RunCmd([
86 os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'),
87 '--src-dir', host_paths.DIR_SOURCE_ROOT,
88 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests']
89 + bb_utils.EncodeProperties(options), cwd=DIR_BUILD_ROOT)
90
91
92 def ExtractBuild(options):
93 bb_annotations.PrintNamedStep('extract_build')
94 RunCmd([os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py')]
95 + bb_utils.EncodeProperties(options), cwd=DIR_BUILD_ROOT)
96
97
98 def BisectPerfRegression(options):
99 args = []
100 if options.extra_src:
101 args = ['--extra_src', options.extra_src]
102 RunCmd([SrcPath('tools', 'prepare-bisect-perf-regression.py'),
103 '-w', os.path.join(host_paths.DIR_SOURCE_ROOT, os.pardir)])
104 RunCmd([SrcPath('tools', 'run-bisect-perf-regression.py'),
105 '-w', os.path.join(host_paths.DIR_SOURCE_ROOT, os.pardir),
106 '--build-properties=%s' % json.dumps(options.build_properties)] +
107 args)
108
109
110 def GetHostStepCmds():
111 return [
112 ('compile', Compile),
113 ('extract_build', ExtractBuild),
114 ('check_webview_licenses', CheckWebViewLicenses),
115 ('bisect_perf_regression', BisectPerfRegression),
116 ('zip_build', ZipBuild)
117 ]
118
119
120 def GetHostStepsOptParser():
121 parser = bb_utils.GetParser()
122 parser.add_option('--steps', help='Comma separated list of host tests.')
123 parser.add_option('--build-targets', default='',
124 help='Comma separated list of build targets.')
125 parser.add_option('--experimental', action='store_true',
126 help='Indicate whether to compile experimental targets.')
127 parser.add_option('--extra_src', default='',
128 help='Path to extra source file. If this is supplied, '
129 'bisect script will use it to override default behavior.')
130 parser.add_option('--run-mb', action='store_true',
131 help='Use mb to generate build files.')
132
133 return parser
134
135
136 def main(argv):
137 parser = GetHostStepsOptParser()
138 options, args = parser.parse_args(argv[1:])
139 if args:
140 return sys.exit('Unused args %s' % args)
141
142 setattr(options, 'target', options.factory_properties.get('target', 'Debug'))
143 setattr(options, 'extra_src',
144 options.factory_properties.get('extra_src', ''))
145
146 if options.steps:
147 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options)
148
149
150 if __name__ == '__main__':
151 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