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 from master.factory import chromium_factory |
5 from master.factory import gclient_factory | 6 from master.factory import gclient_factory |
6 from master.factory import chromium_commands | 7 from master.factory import chromium_commands |
7 | 8 |
8 import config | 9 import config |
9 | 10 |
10 | 11 |
11 class WebRTCFactory(gclient_factory.GClientFactory): | 12 class WebRTCFactory(chromium_factory.ChromiumFactory): |
12 | 13 |
13 CUSTOM_VARS_ROOT_DIR = ('root_dir', 'src') | 14 CUSTOM_VARS_ROOT_DIR = ('root_dir', 'src') |
| 15 |
14 # Can't use the same Valgrind constant as in chromium_factory.py, since WebRTC | 16 # Can't use the same Valgrind constant as in chromium_factory.py, since WebRTC |
15 # uses another path (use_relative_paths=True in DEPS). | 17 # uses another path (use_relative_paths=True in DEPS). |
16 CUSTOM_DEPS_VALGRIND = ('third_party/valgrind', | 18 CUSTOM_DEPS_VALGRIND = ('third_party/valgrind', |
17 config.Master.trunk_url + '/deps/third_party/valgrind/binaries') | 19 config.Master.trunk_url + '/deps/third_party/valgrind/binaries') |
18 | 20 |
19 def __init__(self, build_dir, target_platform, svn_root_url, branch, | 21 def __init__(self, build_dir, target_platform, svn_root_url, branch, |
20 custom_deps_list=None): | 22 custom_deps_list=None, nohooks_on_update=False, target_os=None): |
21 """Creates a WebRTC factory. | 23 """Creates a WebRTC factory. |
22 | 24 |
23 This factory can also be used to build stand-alone projects. | 25 This factory can also be used to build stand-alone projects. |
24 | 26 |
25 Args: | 27 Args: |
26 build_dir: Directory to perform the build relative to. Usually this is | 28 build_dir: Directory to perform the build relative to. Usually this is |
27 trunk/build for WebRTC and other projects. | 29 trunk/build for WebRTC and other projects. |
28 target_platform: Platform, one of 'win32', 'darwin', 'linux2' | 30 target_platform: Platform, one of 'win32', 'darwin', 'linux2' |
29 svn_root_url: Subversion root URL (i.e. without branch/trunk part). | 31 svn_root_url: Subversion root URL (i.e. without branch/trunk part). |
30 branch: Branch name to checkout. | 32 branch: Branch name to checkout. |
31 custom_deps_list: Content to be put in the custom_deps entry of the | 33 custom_deps_list: Content to be put in the custom_deps entry of the |
32 .gclient file for the default solution. The parameter must be a list | 34 .gclient file for the default solution. The parameter must be a list |
33 of tuples with two strings in each: path and remote URL. | 35 of tuples with two strings in each: path and remote URL. |
| 36 nohooks_on_update: If True, no hooks will be executed in the update step. |
| 37 target_os: Used to sync down OS-specific dependencies, if specified. |
34 """ | 38 """ |
| 39 chromium_factory.ChromiumFactory.__init__( |
| 40 self, build_dir, target_platform=target_platform, |
| 41 nohooks_on_update=nohooks_on_update, target_os=target_os) |
| 42 |
35 svn_url = svn_root_url + '/' + branch | 43 svn_url = svn_root_url + '/' + branch |
| 44 |
36 # Use root_dir=src since many Chromium scripts rely on that path. | 45 # Use root_dir=src since many Chromium scripts rely on that path. |
37 custom_vars_list = [self.CUSTOM_VARS_ROOT_DIR] | 46 custom_vars_list = [self.CUSTOM_VARS_ROOT_DIR] |
38 solutions = [] | 47 |
39 solutions.append(gclient_factory.GClientSolution( | 48 # Overwrite solutions of ChromiumFactory since we sync WebRTC, not Chromium. |
| 49 self._solutions = [] |
| 50 self._solutions.append(gclient_factory.GClientSolution( |
40 svn_url, name='src', custom_vars_list=custom_vars_list, | 51 svn_url, name='src', custom_vars_list=custom_vars_list, |
41 custom_deps_list=custom_deps_list)) | 52 custom_deps_list=custom_deps_list)) |
42 if config.Master.webrtc_internal_url: | 53 if config.Master.webrtc_internal_url: |
43 solutions.append(gclient_factory.GClientSolution( | 54 self._solutions.append(gclient_factory.GClientSolution( |
44 config.Master.webrtc_internal_url, name='webrtc-internal', | 55 config.Master.webrtc_internal_url, name='webrtc-internal', |
45 custom_vars_list=custom_vars_list)) | 56 custom_vars_list=custom_vars_list)) |
46 gclient_factory.GClientFactory.__init__(self, build_dir, solutions, | |
47 target_platform=target_platform) | |
48 | 57 |
49 def WebRTCFactory(self, target='Debug', clobber=False, tests=None, mode=None, | 58 def WebRTCFactory(self, target='Debug', clobber=False, tests=None, mode=None, |
50 slave_type='BuilderTester', options=None, | 59 slave_type='BuilderTester', options=None, |
51 compile_timeout=1200, build_url=None, project=None, | 60 compile_timeout=1200, build_url=None, project=None, |
52 factory_properties=None, gclient_deps=None): | 61 factory_properties=None, gclient_deps=None): |
53 options = options or '' | 62 options = options or '' |
54 tests = tests or [] | 63 tests = tests or [] |
55 factory_properties = factory_properties or {} | 64 factory_properties = factory_properties or {} |
56 | 65 |
57 if factory_properties.get('needs_valgrind'): | 66 if factory_properties.get('needs_valgrind'): |
58 self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_VALGRIND] | 67 self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_VALGRIND] |
59 factory = self.BuildFactory(target, clobber, tests, mode, slave_type, | 68 factory = self.BuildFactory(target, clobber, tests, mode, slave_type, |
60 options, compile_timeout, build_url, project, | 69 options, compile_timeout, build_url, project, |
61 factory_properties, gclient_deps) | 70 factory_properties, gclient_deps) |
62 | 71 |
63 # Get the factory command object to create new steps to the factory. | 72 # Get the factory command object to create new steps to the factory. |
64 cmds = chromium_commands.ChromiumCommands(factory, target, | 73 cmds = chromium_commands.ChromiumCommands(factory, target, self._build_dir, |
65 self._build_dir, | 74 self._target_platform) |
66 self._target_platform) | |
67 # Override test runner script paths with our own that can run any test and | 75 # Override test runner script paths with our own that can run any test and |
68 # have our suppressions configured. | 76 # have our suppressions configured. |
69 valgrind_script_path = cmds.PathJoin('src', 'tools', 'valgrind-webrtc') | 77 valgrind_script_path = cmds.PathJoin('src', 'tools', 'valgrind-webrtc') |
70 cmds._posix_memory_tests_runner = cmds.PathJoin(valgrind_script_path, | 78 cmds._posix_memory_tests_runner = cmds.PathJoin(valgrind_script_path, |
71 'webrtc_tests.sh') | 79 'webrtc_tests.sh') |
72 cmds._win_memory_tests_runner = cmds.PathJoin(valgrind_script_path, | 80 cmds._win_memory_tests_runner = cmds.PathJoin(valgrind_script_path, |
73 'webrtc_tests.bat') | 81 'webrtc_tests.bat') |
74 # Add tests. | 82 # Add tests. |
75 gclient_env = factory_properties.get('gclient_env', {}) | 83 gclient_env = factory_properties.get('gclient_env', {}) |
76 gyp_defines = gclient_env.get('GYP_DEFINES', '') | 84 gyp_defines = gclient_env.get('GYP_DEFINES', '') |
77 for test in tests: | 85 for test in tests: |
78 if 'build_for_tool=memcheck' in gyp_defines: | 86 if 'build_for_tool=memcheck' in gyp_defines: |
79 cmds.AddMemoryTest(test, 'memcheck', | 87 cmds.AddMemoryTest(test, 'memcheck', |
80 factory_properties=factory_properties) | 88 factory_properties=factory_properties) |
81 elif 'build_for_tool=tsan' in gyp_defines: | 89 elif 'build_for_tool=tsan' in gyp_defines: |
82 cmds.AddMemoryTest(test, 'tsan', factory_properties=factory_properties) | 90 cmds.AddMemoryTest(test, 'tsan', factory_properties=factory_properties) |
83 else: | 91 else: |
84 cmds.AddAnnotatedGTestTestStep(test, factory_properties) | 92 cmds.AddAnnotatedGTestTestStep(test, factory_properties) |
85 return factory | 93 return factory |
OLD | NEW |