OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Utility class to build the webm master BuildFactory's. |
| 6 |
| 7 Based on gclient_factory.py and adds webm-specific steps.""" |
| 8 |
| 9 import os |
| 10 |
| 11 from master.factory import gclient_factory |
| 12 from master.factory import webm_commands |
| 13 from master.factory.build_factory import BuildFactory |
| 14 |
| 15 import config |
| 16 |
| 17 |
| 18 class WebMFactory(object): |
| 19 """Encapsulates data and methods common to the webm master.cfg file.""" |
| 20 |
| 21 DEFAULT_TARGET_PLATFORM = config.Master.default_platform |
| 22 |
| 23 def __init__(self, build_dir, target_platform=None): |
| 24 self._build_dir = build_dir |
| 25 self._target_platform = target_platform or 'win32' |
| 26 |
| 27 def _AddTests(self, factory_cmd_obj, tests, mode=None, |
| 28 factory_properties=None): |
| 29 """Add the tests listed in 'tests' to the factory_cmd_obj.""" |
| 30 factory_properties = factory_properties or {} |
| 31 |
| 32 # This function is too crowded, try to simplify it a little. |
| 33 def R(test): |
| 34 return gclient_factory.ShouldRunTest(tests, test) |
| 35 f = factory_cmd_obj |
| 36 fp = factory_properties |
| 37 |
| 38 # ADD TESTS HERE. Example: |
| 39 # if R('unit_tests'): f.AddUnitTests() |
| 40 |
| 41 def WebMFactory(self, identifier, target='Release', clobber=False, |
| 42 tests=None, mode=None, slave_type='BuilderTester', |
| 43 options=None, compile_timeout=1200, build_url=None, |
| 44 project=None, factory_properties=None): |
| 45 factory_properties = factory_properties or {} |
| 46 tests = tests or [] |
| 47 |
| 48 factory = BuildFactory() |
| 49 |
| 50 # Get the factory command object to create new steps to the factory. |
| 51 webm_cmd_obj = webm_commands.WebMCommands(factory, |
| 52 identifier, |
| 53 target, |
| 54 self._build_dir, |
| 55 self._target_platform) |
| 56 |
| 57 # First kill any svn.exe tasks so we can update in peace, and |
| 58 # afterwards use the checked-out script to kill everything else. |
| 59 if self._target_platform == 'win32': |
| 60 webm_cmd_obj.AddSvnKillStep() |
| 61 webm_cmd_obj.AddUpdateScriptStep() |
| 62 # Once the script is updated, the zombie processes left by the previous |
| 63 # run can be killed. |
| 64 if self._target_platform == 'win32': |
| 65 webm_cmd_obj.AddTaskkillStep() |
| 66 |
| 67 # ADD UPDATE AND COMPILE STEP HERE. |
| 68 |
| 69 # Add all the tests. |
| 70 self._AddTests(webm_cmd_obj, tests, mode, factory_properties) |
| 71 |
| 72 return factory |
OLD | NEW |