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

Side by Side Diff: buildbot/buildbot_lib.py

Issue 1924743004: Remove GYP build from bots and 'gclient runhooks' (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: punt gyp build from pnacl script Created 4 years, 7 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/gyp_nacl.py ('k') | buildbot/buildbot_pnacl.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import optparse 6 import optparse
7 import os.path 7 import os.path
8 import shutil 8 import shutil
9 import subprocess 9 import subprocess
10 import stat 10 import stat
11 import sys 11 import sys
12 import time 12 import time
13 import traceback 13 import traceback
14 14
15 15
16 ARCH_MAP = { 16 ARCH_MAP = {
17 '32': { 17 '32': {
18 'gyp_arch': 'ia32', 18 'gn_arch': 'x86',
19 'scons_platform': 'x86-32', 19 'scons_platform': 'x86-32',
20 }, 20 },
21 '64': { 21 '64': {
22 'gyp_arch': 'x64', 22 'gn_arch': 'x64',
23 'scons_platform': 'x86-64', 23 'scons_platform': 'x86-64',
24 }, 24 },
25 'arm': { 25 'arm': {
26 'gyp_arch': 'arm', 26 'gn_arch': 'arm',
27 'scons_platform': 'arm', 27 'scons_platform': 'arm',
28 }, 28 },
29 'mips32': { 29 'mips32': {
30 'gyp_arch': 'mips32', 30 'gn_arch': 'mipsel',
31 'scons_platform': 'mips32', 31 'scons_platform': 'mips32',
32 }, 32 },
33 } 33 }
34 34
35 35
36 def GNArch(arch):
37 return ARCH_MAP[arch]['gn_arch']
38
39
36 def RunningOnBuildbot(): 40 def RunningOnBuildbot():
37 return os.environ.get('BUILDBOT_SLAVE_TYPE') is not None 41 return os.environ.get('BUILDBOT_SLAVE_TYPE') is not None
38 42
39 43
40 def GetHostPlatform(): 44 def GetHostPlatform():
41 sys_platform = sys.platform.lower() 45 sys_platform = sys.platform.lower()
42 if sys_platform.startswith('linux'): 46 if sys_platform.startswith('linux'):
43 return 'linux' 47 return 'linux'
44 elif sys_platform in ('win', 'win32', 'windows', 'cygwin'): 48 elif sys_platform in ('win', 'win32', 'windows', 'cygwin'):
45 return 'win' 49 return 'win'
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 # The end slash is needed because the batch files expect it. 117 # The end slash is needed because the batch files expect it.
114 context.SetEnv(comntools_var, comntools + '\\') 118 context.SetEnv(comntools_var, comntools + '\\')
115 119
116 # This environment variable will SCons to print debug info while it searches 120 # This environment variable will SCons to print debug info while it searches
117 # for MSVC. 121 # for MSVC.
118 context.SetEnv('SCONS_MSCOMMON_DEBUG', '-') 122 context.SetEnv('SCONS_MSCOMMON_DEBUG', '-')
119 123
120 # Needed for finding devenv. 124 # Needed for finding devenv.
121 context['msvc'] = msvc 125 context['msvc'] = msvc
122 126
123 SetupGyp(context, [])
124
125
126 def SetupGyp(context, extra_vars=[]):
127 if RunningOnBuildbot():
128 goma_opts = [
129 'use_goma=1',
130 'gomadir=/b/build/goma',
131 ]
132 else:
133 goma_opts = []
134 context.SetEnv('GYP_DEFINES', ' '.join(
135 context['gyp_vars'] + goma_opts + extra_vars))
136
137 127
138 def SetupLinuxEnvironment(context): 128 def SetupLinuxEnvironment(context):
139 if context['arch'] == 'mips32': 129 if context['arch'] == 'mips32':
140 # Ensure the trusted mips toolchain is installed. 130 # Ensure the trusted mips toolchain is installed.
141 cmd = ['build/package_version/package_version.py', '--packages', 131 cmd = ['build/package_version/package_version.py', '--packages',
142 'linux_x86/mips_trusted', 'sync', '-x'] 132 'linux_x86/mips_trusted', 'sync', '-x']
143 Command(context, cmd) 133 Command(context, cmd)
144 134
145 SetupGyp(context, ['target_arch='+context['gyp_arch']])
146
147
148 def SetupMacEnvironment(context):
149 SetupGyp(context, ['target_arch='+context['gyp_arch']])
150
151
152 def SetupAndroidEnvironment(context):
153 SetupGyp(context, ['OS=android', 'target_arch='+context['gyp_arch']])
154 context.SetEnv('GYP_CROSSCOMPILE', '1')
155
156 135
157 def ParseStandardCommandLine(context): 136 def ParseStandardCommandLine(context):
158 """ 137 """
159 The standard buildbot scripts require 3 arguments to run. The first 138 The standard buildbot scripts require 3 arguments to run. The first
160 argument (dbg/opt) controls if the build is a debug or a release build. The 139 argument (dbg/opt) controls if the build is a debug or a release build. The
161 second argument (32/64) controls the machine architecture being targeted. 140 second argument (32/64) controls the machine architecture being targeted.
162 The third argument (newlib/glibc) controls which c library we're using for 141 The third argument (newlib/glibc) controls which c library we're using for
163 the nexes. Different buildbots may have different sets of arguments. 142 the nexes. Different buildbots may have different sets of arguments.
164 """ 143 """
165 144
(...skipping 12 matching lines...) Expand all
178 help='Build and test for code coverage.') 157 help='Build and test for code coverage.')
179 parser.add_option('--validator', dest='validator', default=False, 158 parser.add_option('--validator', dest='validator', default=False,
180 action='store_true', 159 action='store_true',
181 help='Only run validator regression test') 160 help='Only run validator regression test')
182 parser.add_option('--asan', dest='asan', default=False, 161 parser.add_option('--asan', dest='asan', default=False,
183 action='store_true', help='Build trusted code with ASan.') 162 action='store_true', help='Build trusted code with ASan.')
184 parser.add_option('--scons-args', dest='scons_args', default =[], 163 parser.add_option('--scons-args', dest='scons_args', default =[],
185 action='append', help='Extra scons arguments.') 164 action='append', help='Extra scons arguments.')
186 parser.add_option('--step-suffix', metavar='SUFFIX', default='', 165 parser.add_option('--step-suffix', metavar='SUFFIX', default='',
187 help='Append SUFFIX to buildbot step names.') 166 help='Append SUFFIX to buildbot step names.')
188 parser.add_option('--no-gyp', dest='no_gyp', default=False, 167 parser.add_option('--no-gn', dest='no_gn', default=False,
189 action='store_true', help='Do not run the gyp build') 168 action='store_true', help='Do not run the GN build')
190 parser.add_option('--no-goma', dest='no_goma', default=False, 169 parser.add_option('--no-goma', dest='no_goma', default=False,
191 action='store_true', help='Do not run with goma') 170 action='store_true', help='Do not run with goma')
192 parser.add_option('--use-breakpad-tools', dest='use_breakpad_tools', 171 parser.add_option('--use-breakpad-tools', dest='use_breakpad_tools',
193 default=False, action='store_true', 172 default=False, action='store_true',
194 help='Use breakpad tools for testing') 173 help='Use breakpad tools for testing')
195 parser.add_option('--skip-build', dest='skip_build', default=False, 174 parser.add_option('--skip-build', dest='skip_build', default=False,
196 action='store_true', 175 action='store_true',
197 help='Skip building steps in buildbot_pnacl') 176 help='Skip building steps in buildbot_pnacl')
198 parser.add_option('--skip-run', dest='skip_run', default=False, 177 parser.add_option('--skip-run', dest='skip_run', default=False,
199 action='store_true', 178 action='store_true',
(...skipping 20 matching lines...) Expand all
220 199
221 context['platform'] = platform 200 context['platform'] = platform
222 context['mode'] = mode 201 context['mode'] = mode
223 context['arch'] = arch 202 context['arch'] = arch
224 context['android'] = options.android 203 context['android'] = options.android
225 # ASan is Clang, so set the flag to simplify other checks. 204 # ASan is Clang, so set the flag to simplify other checks.
226 context['clang'] = options.clang or options.asan 205 context['clang'] = options.clang or options.asan
227 context['validator'] = options.validator 206 context['validator'] = options.validator
228 context['asan'] = options.asan 207 context['asan'] = options.asan
229 # TODO(ncbray) turn derived values into methods. 208 # TODO(ncbray) turn derived values into methods.
230 context['gyp_mode'] = {
231 'opt': 'Release',
232 'dbg': 'Debug',
233 'coverage': 'Debug'}[mode]
234 context['gn_is_debug'] = { 209 context['gn_is_debug'] = {
235 'opt': 'false', 210 'opt': 'false',
236 'dbg': 'true', 211 'dbg': 'true',
237 'coverage': 'true'}[mode] 212 'coverage': 'true'}[mode]
238 context['gyp_arch'] = ARCH_MAP[arch]['gyp_arch'] 213 context['gn_arch'] = GNArch(arch)
239 context['gyp_vars'] = []
240 if context['clang']:
241 context['gyp_vars'].append('clang=1')
242 if context['asan']:
243 context['gyp_vars'].append('asan=1')
244 context['default_scons_platform'] = ARCH_MAP[arch]['scons_platform'] 214 context['default_scons_platform'] = ARCH_MAP[arch]['scons_platform']
245 context['default_scons_mode'] = ['nacl'] 215 context['default_scons_mode'] = ['nacl']
246 # Only Linux can build trusted code on ARM. 216 # Only Linux can build trusted code on ARM.
247 # TODO(mcgrathr): clean this up somehow 217 # TODO(mcgrathr): clean this up somehow
248 if arch != 'arm' or platform == 'linux': 218 if arch != 'arm' or platform == 'linux':
249 context['default_scons_mode'] += [mode + '-host'] 219 context['default_scons_mode'] += [mode + '-host']
250 context['use_glibc'] = toolchain == 'glibc' 220 context['use_glibc'] = toolchain == 'glibc'
251 context['pnacl'] = toolchain == 'pnacl' 221 context['pnacl'] = toolchain == 'pnacl'
252 context['nacl_clang'] = toolchain == 'nacl_clang' 222 context['nacl_clang'] = toolchain == 'nacl_clang'
253 context['max_jobs'] = 8 223 context['max_jobs'] = 8
254 context['dry_run'] = options.dry_run 224 context['dry_run'] = options.dry_run
255 context['inside_toolchain'] = options.inside_toolchain 225 context['inside_toolchain'] = options.inside_toolchain
256 context['step_suffix'] = options.step_suffix 226 context['step_suffix'] = options.step_suffix
257 context['no_gyp'] = options.no_gyp 227 context['no_gn'] = options.no_gn
258 context['no_goma'] = options.no_goma 228 context['no_goma'] = options.no_goma
259 context['coverage'] = options.coverage 229 context['coverage'] = options.coverage
260 context['use_breakpad_tools'] = options.use_breakpad_tools 230 context['use_breakpad_tools'] = options.use_breakpad_tools
261 context['scons_args'] = options.scons_args 231 context['scons_args'] = options.scons_args
262 context['skip_build'] = options.skip_build 232 context['skip_build'] = options.skip_build
263 context['skip_run'] = options.skip_run 233 context['skip_run'] = options.skip_run
264 # Don't run gyp on coverage builds.
265 if context['coverage']:
266 context['no_gyp'] = True
267 234
268 for key, value in sorted(context.config.items()): 235 for key, value in sorted(context.config.items()):
269 print '%s=%s' % (key, value) 236 print '%s=%s' % (key, value)
270 237
271 238
272 def EnsureDirectoryExists(path): 239 def EnsureDirectoryExists(path):
273 """ 240 """
274 Create a directory if it does not already exist. 241 Create a directory if it does not already exist.
275 Does not mask failures, but there really shouldn't be any. 242 Does not mask failures, but there really shouldn't be any.
276 """ 243 """
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 # Otherwise these go back to the preamble. 650 # Otherwise these go back to the preamble.
684 with Step('summary', status): 651 with Step('summary', status):
685 if status.ever_failed: 652 if status.ever_failed:
686 print 'There were failed stages.' 653 print 'There were failed stages.'
687 else: 654 else:
688 print 'Success.' 655 print 'Success.'
689 # Display a summary of the build. 656 # Display a summary of the build.
690 status.DisplayBuildStatus() 657 status.DisplayBuildStatus()
691 658
692 sys.exit(status.ReturnValue()) 659 sys.exit(status.ReturnValue())
OLDNEW
« no previous file with comments | « build/gyp_nacl.py ('k') | buildbot/buildbot_pnacl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698