Chromium Code Reviews| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 no_gclient_branch=no_gclient_branch) | 202 no_gclient_branch=no_gclient_branch) |
| 203 elif not delay_compile_step: | 203 elif not delay_compile_step: |
| 204 self.AddUpdateStep(gclient_spec, factory_properties, factory, | 204 self.AddUpdateStep(gclient_spec, factory_properties, factory, |
| 205 slave_type, sudo_for_remove, gclient_deps=gclient_deps) | 205 slave_type, sudo_for_remove, gclient_deps=gclient_deps) |
| 206 return factory | 206 return factory |
| 207 | 207 |
| 208 def BuildFactory(self, target='Release', clobber=False, tests=None, mode=None, | 208 def BuildFactory(self, target='Release', clobber=False, tests=None, mode=None, |
| 209 slave_type='BuilderTester', options=None, | 209 slave_type='BuilderTester', options=None, |
| 210 compile_timeout=1200, build_url=None, project=None, | 210 compile_timeout=1200, build_url=None, project=None, |
| 211 factory_properties=None, gclient_deps=None, | 211 factory_properties=None, gclient_deps=None, |
| 212 target_arch=None): | 212 target_arch=None, add_archive_steps=True): |
|
nsylvain
2012/11/27 00:23:15
What about "skip_archive_steps=False" instead. It
iannucci
2012/11/27 01:39:13
Good call. Done.
| |
| 213 factory_properties = factory_properties or {} | 213 factory_properties = factory_properties or {} |
| 214 if options and '--build-tool=ninja' in options: | 214 if options and '--build-tool=ninja' in options: |
| 215 factory_properties['gclient_env']['GYP_GENERATORS'] = 'ninja' | 215 factory_properties['gclient_env']['GYP_GENERATORS'] = 'ninja' |
| 216 if '--compiler=goma-clang' in options: | 216 if '--compiler=goma-clang' in options: |
| 217 # Ninja needs CC and CXX set at gyp time. | 217 # Ninja needs CC and CXX set at gyp time. |
| 218 factory_properties['gclient_env']['CC'] = 'clang' | 218 factory_properties['gclient_env']['CC'] = 'clang' |
| 219 factory_properties['gclient_env']['CXX'] = 'clang++' | 219 factory_properties['gclient_env']['CXX'] = 'clang++' |
| 220 | 220 |
| 221 # Create the spec for the solutions | 221 # Create the spec for the solutions |
| 222 gclient_spec = self.BuildGClientSpec(tests) | 222 gclient_spec = self.BuildGClientSpec(tests) |
| 223 | 223 |
| 224 # Initialize the factory with the basic steps. | 224 # Initialize the factory with the basic steps. |
| 225 factory = self.BaseFactory(gclient_spec, | 225 factory = self.BaseFactory(gclient_spec, |
| 226 factory_properties=factory_properties, | 226 factory_properties=factory_properties, |
| 227 slave_type=slave_type, | 227 slave_type=slave_type, |
| 228 gclient_deps=gclient_deps) | 228 gclient_deps=gclient_deps) |
| 229 | 229 |
| 230 # Get the factory command object to create new steps to the factory. | 230 # Get the factory command object to create new steps to the factory. |
| 231 factory_cmd_obj = commands.FactoryCommands(factory, target, | 231 factory_cmd_obj = commands.FactoryCommands(factory, target, |
| 232 self._build_dir, | 232 self._build_dir, |
| 233 self._target_platform, | 233 self._target_platform, |
| 234 target_arch) | 234 target_arch) |
| 235 | 235 |
| 236 # Update clang if necessary. | 236 # Update clang if necessary. |
| 237 gclient_env = factory_properties.get('gclient_env', {}) | 237 gclient_env = factory_properties.get('gclient_env', {}) |
| 238 if ('clang=1' in gclient_env.get('GYP_DEFINES', '') or | 238 if ('clang=1' in gclient_env.get('GYP_DEFINES', '') or |
| 239 'asan=1' in gclient_env.get('GYP_DEFINES', '')): | 239 (self._target_platform != 'win32' and |
| 240 'asan=1' in gclient_env.get('GYP_DEFINES', ''))): | |
| 240 factory_cmd_obj.AddUpdateClangStep() | 241 factory_cmd_obj.AddUpdateClangStep() |
| 241 | 242 |
| 242 # Add a step to cleanup temporary files and data left from a previous run | 243 # Add a step to cleanup temporary files and data left from a previous run |
| 243 # to prevent the drives from becoming full over time. | 244 # to prevent the drives from becoming full over time. |
| 244 factory_cmd_obj.AddTempCleanupStep() | 245 factory_cmd_obj.AddTempCleanupStep() |
| 245 | 246 |
| 246 # Add the compile step if needed. | 247 # Add the compile step if needed. |
| 247 if slave_type in ['BuilderTester', 'Builder', 'Trybot', 'Indexer']: | 248 if slave_type in ['BuilderTester', 'Builder', 'Trybot', 'Indexer']: |
| 248 factory_cmd_obj.AddCompileStep( | 249 factory_cmd_obj.AddCompileStep( |
| 249 project or self._project, | 250 project or self._project, |
| 250 clobber, | 251 clobber, |
| 251 mode=mode, | 252 mode=mode, |
| 252 options=options, | 253 options=options, |
| 253 timeout=compile_timeout, | 254 timeout=compile_timeout, |
| 254 env=factory_properties.get('compile_env')) | 255 env=factory_properties.get('compile_env')) |
| 255 | 256 |
| 256 # Archive the full output directory if the machine is a builder. | 257 if add_archive_steps: |
| 257 if slave_type == 'Builder': | 258 # Archive the full output directory if the machine is a builder. |
| 258 factory_cmd_obj.AddZipBuild(halt_on_failure=True, | 259 if slave_type == 'Builder': |
| 259 factory_properties=factory_properties) | 260 factory_cmd_obj.AddZipBuild(halt_on_failure=True, |
| 261 factory_properties=factory_properties) | |
| 260 | 262 |
| 261 # Download the full output directory if the machine is a tester. | 263 # Download the full output directory if the machine is a tester. |
| 262 if slave_type == 'Tester': | 264 if slave_type == 'Tester': |
| 263 factory_cmd_obj.AddExtractBuild(build_url, | 265 factory_cmd_obj.AddExtractBuild(build_url, |
| 264 factory_properties=factory_properties) | 266 factory_properties=factory_properties) |
| 265 | 267 |
| 266 return factory | 268 return factory |
| 267 | 269 |
| 268 # pylint: disable=R0201 | 270 # pylint: disable=R0201 |
| 269 def TriggerFactory(self, factory, slave_type, factory_properties): | 271 def TriggerFactory(self, factory, slave_type, factory_properties): |
| 270 """Add post steps on a build created by BuildFactory.""" | 272 """Add post steps on a build created by BuildFactory.""" |
| 271 # Trigger any schedulers waiting on the build to complete. | 273 # Trigger any schedulers waiting on the build to complete. |
| 272 factory_properties = factory_properties or {} | 274 factory_properties = factory_properties or {} |
| 273 if factory_properties.get('trigger') is None: | 275 if factory_properties.get('trigger') is None: |
| 274 return | 276 return |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 no_gclient_revision=no_gclient_revision, | 341 no_gclient_revision=no_gclient_revision, |
| 340 gclient_transitive=gclient_transitive, | 342 gclient_transitive=gclient_transitive, |
| 341 primary_repo=primary_repo, | 343 primary_repo=primary_repo, |
| 342 gclient_jobs=gclient_jobs) | 344 gclient_jobs=gclient_jobs) |
| 343 | 345 |
| 344 if slave_type in ('AnnotatedTrybot', 'CrosTrybot', 'Trybot'): | 346 if slave_type in ('AnnotatedTrybot', 'CrosTrybot', 'Trybot'): |
| 345 factory_cmd_obj.AddApplyIssueStep(timeout=timeout) | 347 factory_cmd_obj.AddApplyIssueStep(timeout=timeout) |
| 346 | 348 |
| 347 if not self._nohooks_on_update: | 349 if not self._nohooks_on_update: |
| 348 factory_cmd_obj.AddRunHooksStep(env=env, timeout=timeout) | 350 factory_cmd_obj.AddRunHooksStep(env=env, timeout=timeout) |
| OLD | NEW |