OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Utility classes to generate and manage a BuildFactory to be passed to a | 5 """Utility classes to generate and manage a BuildFactory to be passed to a |
6 builder dictionary as the 'factory' member, for each builder in c['builders']. | 6 builder dictionary as the 'factory' member, for each builder in c['builders']. |
7 | 7 |
8 Specifically creates a base BuildFactory that will execute a gclient checkout | 8 Specifically creates a base BuildFactory that will execute a gclient checkout |
9 first.""" | 9 first.""" |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 no_gclient_branch=no_gclient_branch) | 204 no_gclient_branch=no_gclient_branch) |
205 elif not delay_compile_step: | 205 elif not delay_compile_step: |
206 self.AddUpdateStep(gclient_spec, factory_properties, factory, | 206 self.AddUpdateStep(gclient_spec, factory_properties, factory, |
207 slave_type, sudo_for_remove, gclient_deps=gclient_deps) | 207 slave_type, sudo_for_remove, gclient_deps=gclient_deps) |
208 return factory | 208 return factory |
209 | 209 |
210 def BuildFactory(self, target='Release', clobber=False, tests=None, mode=None, | 210 def BuildFactory(self, target='Release', clobber=False, tests=None, mode=None, |
211 slave_type='BuilderTester', options=None, | 211 slave_type='BuilderTester', options=None, |
212 compile_timeout=1200, build_url=None, project=None, | 212 compile_timeout=1200, build_url=None, project=None, |
213 factory_properties=None, gclient_deps=None, | 213 factory_properties=None, gclient_deps=None, |
214 target_arch=None): | 214 target_arch=None, skip_archive_steps=False): |
215 factory_properties = factory_properties or {} | 215 factory_properties = factory_properties or {} |
216 if options and '--build-tool=ninja' in options: | 216 if options and '--build-tool=ninja' in options: |
217 factory_properties['gclient_env']['GYP_GENERATORS'] = 'ninja' | 217 factory_properties['gclient_env']['GYP_GENERATORS'] = 'ninja' |
218 if '--compiler=goma-clang' in options: | 218 if '--compiler=goma-clang' in options: |
219 # Ninja needs CC and CXX set at gyp time. | 219 # Ninja needs CC and CXX set at gyp time. |
220 factory_properties['gclient_env']['CC'] = 'clang' | 220 factory_properties['gclient_env']['CC'] = 'clang' |
221 factory_properties['gclient_env']['CXX'] = 'clang++' | 221 factory_properties['gclient_env']['CXX'] = 'clang++' |
222 | 222 |
223 # Create the spec for the solutions | 223 # Create the spec for the solutions |
224 gclient_spec = self.BuildGClientSpec(tests) | 224 gclient_spec = self.BuildGClientSpec(tests) |
225 | 225 |
226 # Initialize the factory with the basic steps. | 226 # Initialize the factory with the basic steps. |
227 factory = self.BaseFactory(gclient_spec, | 227 factory = self.BaseFactory(gclient_spec, |
228 factory_properties=factory_properties, | 228 factory_properties=factory_properties, |
229 slave_type=slave_type, | 229 slave_type=slave_type, |
230 gclient_deps=gclient_deps) | 230 gclient_deps=gclient_deps) |
231 | 231 |
232 # Get the factory command object to create new steps to the factory. | 232 # Get the factory command object to create new steps to the factory. |
233 factory_cmd_obj = commands.FactoryCommands(factory, target, | 233 factory_cmd_obj = commands.FactoryCommands(factory, target, |
234 self._build_dir, | 234 self._build_dir, |
235 self._target_platform, | 235 self._target_platform, |
236 target_arch) | 236 target_arch) |
237 | 237 |
238 # Update clang if necessary. | 238 # Update clang if necessary. |
239 gclient_env = factory_properties.get('gclient_env', {}) | 239 gclient_env = factory_properties.get('gclient_env', {}) |
240 if ('clang=1' in gclient_env.get('GYP_DEFINES', '') or | 240 if ('clang=1' in gclient_env.get('GYP_DEFINES', '') or |
241 'asan=1' in gclient_env.get('GYP_DEFINES', '')): | 241 (self._target_platform != 'win32' and |
| 242 factory_properties.get('asan'))): |
242 factory_cmd_obj.AddUpdateClangStep() | 243 factory_cmd_obj.AddUpdateClangStep() |
243 | 244 |
244 # Add a step to cleanup temporary files and data left from a previous run | 245 # Add a step to cleanup temporary files and data left from a previous run |
245 # to prevent the drives from becoming full over time. | 246 # to prevent the drives from becoming full over time. |
246 factory_cmd_obj.AddTempCleanupStep() | 247 factory_cmd_obj.AddTempCleanupStep() |
247 | 248 |
248 # Add the compile step if needed. | 249 # Add the compile step if needed. |
249 if slave_type in ['BuilderTester', 'Builder', 'Trybot', 'Indexer']: | 250 if slave_type in ['BuilderTester', 'Builder', 'Trybot', 'Indexer']: |
250 factory_cmd_obj.AddCompileStep( | 251 factory_cmd_obj.AddCompileStep( |
251 project or self._project, | 252 project or self._project, |
252 clobber, | 253 clobber, |
253 mode=mode, | 254 mode=mode, |
254 options=options, | 255 options=options, |
255 timeout=compile_timeout, | 256 timeout=compile_timeout, |
256 env=factory_properties.get('compile_env')) | 257 env=factory_properties.get('compile_env')) |
257 | 258 |
258 # Archive the full output directory if the machine is a builder. | 259 if not skip_archive_steps: |
259 if slave_type == 'Builder': | 260 # Archive the full output directory if the machine is a builder. |
260 factory_cmd_obj.AddZipBuild(halt_on_failure=True, | 261 if slave_type == 'Builder': |
261 factory_properties=factory_properties) | 262 factory_cmd_obj.AddZipBuild(halt_on_failure=True, |
| 263 factory_properties=factory_properties) |
262 | 264 |
263 # Download the full output directory if the machine is a tester. | 265 # Download the full output directory if the machine is a tester. |
264 if slave_type == 'Tester': | 266 if slave_type == 'Tester': |
265 factory_cmd_obj.AddExtractBuild(build_url, | 267 factory_cmd_obj.AddExtractBuild(build_url, |
266 factory_properties=factory_properties) | 268 factory_properties=factory_properties) |
267 | 269 |
268 return factory | 270 return factory |
269 | 271 |
270 # pylint: disable=R0201 | 272 # pylint: disable=R0201 |
271 def TriggerFactory(self, factory, slave_type, factory_properties): | 273 def TriggerFactory(self, factory, slave_type, factory_properties): |
272 """Add post steps on a build created by BuildFactory.""" | 274 """Add post steps on a build created by BuildFactory.""" |
273 # Trigger any schedulers waiting on the build to complete. | 275 # Trigger any schedulers waiting on the build to complete. |
274 factory_properties = factory_properties or {} | 276 factory_properties = factory_properties or {} |
275 if factory_properties.get('trigger') is None: | 277 if factory_properties.get('trigger') is None: |
276 return | 278 return |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 primary_repo=primary_repo, | 345 primary_repo=primary_repo, |
344 gclient_jobs=gclient_jobs) | 346 gclient_jobs=gclient_jobs) |
345 | 347 |
346 if slave_type in ('AnnotatedTrybot', 'CrosTrybot', 'Trybot'): | 348 if slave_type in ('AnnotatedTrybot', 'CrosTrybot', 'Trybot'): |
347 factory_cmd_obj.AddApplyIssueStep( | 349 factory_cmd_obj.AddApplyIssueStep( |
348 timeout=timeout, | 350 timeout=timeout, |
349 server=config.Master.TryServer.code_review_site) | 351 server=config.Master.TryServer.code_review_site) |
350 | 352 |
351 if not self._nohooks_on_update: | 353 if not self._nohooks_on_update: |
352 factory_cmd_obj.AddRunHooksStep(env=env, timeout=timeout) | 354 factory_cmd_obj.AddRunHooksStep(env=env, timeout=timeout) |
OLD | NEW |