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 pagespeed master BuildFactory's. | |
6 | |
7 Based on gclient_factory.py and adds pagespeed-specific steps.""" | |
8 | |
9 import os | |
10 | |
11 from master.factory import gclient_factory | |
12 from master.factory import pagespeed_commands | |
13 from master.factory.build_factory import BuildFactory | |
14 | |
15 import config | |
16 | |
17 | |
18 class PageSpeedFactory(gclient_factory.GClientFactory): | |
19 """Encapsulates data and methods common to the pagespeed master.cfg file.""" | |
20 | |
21 DEFAULT_TARGET_PLATFORM = config.Master.default_platform | |
22 | |
23 def __init__(self, build_dir, target_platform=None): | |
24 main = gclient_factory.GClientSolution( | |
25 "http://page-speed.googlecode.com/svn/lib/trunk/src") | |
26 | |
27 gclient_factory.GClientFactory.__init__(self, build_dir, [main], | |
28 target_platform=target_platform) | |
29 | |
30 def _AddTests(self, factory_cmd_obj, tests, mode=None, | |
31 factory_properties=None): | |
32 """Add the tests listed in 'tests' to the factory_cmd_obj.""" | |
33 factory_properties = factory_properties or {} | |
34 | |
35 # This function is too crowded, try to simplify it a little. | |
36 def R(test): | |
37 return gclient_factory.ShouldRunTest(tests, test) | |
38 f = factory_cmd_obj | |
39 fp = factory_properties | |
40 | |
41 # ADD TESTS HERE. Example: | |
42 # if R('unit_tests'): f.AddUnitTests() | |
43 | |
44 def PageSpeedFactory(self, identifier, target='Release', clobber=False, | |
45 tests=None, mode=None, slave_type='BuilderTester', | |
46 options=None, compile_timeout=1200, build_url=None, | |
47 project=None, factory_properties=None): | |
48 factory_properties = factory_properties or {} | |
49 tests = tests or [] | |
50 | |
51 factory = self.BuildFactory(identifier, target, clobber, tests, mode, | |
52 slave_type, options, compile_timeout, build_url, | |
53 project, factory_properties) | |
54 | |
55 # Get the factory command object to create new steps to the factory. | |
56 pagespeed_cmd_obj = pagespeed_commands.PageSpeedCommands(factory, | |
57 identifier, | |
58 target, | |
59 self._build_dir, | |
60 self._target_platfo rm) | |
chase
2010/11/30 22:27:20
80 chars, maybe move all args starting at factory
| |
61 | |
62 # Add all the tests. | |
63 self._AddTests(pagespeed_cmd_obj, tests, mode, factory_properties) | |
64 | |
65 return factory | |
OLD | NEW |