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 class to build the chromium master BuildFactory's. | 5 """Utility class to build the chromium master BuildFactory's. |
6 | 6 |
7 Based on gclient_factory.py and adds chromium-specific steps.""" | 7 Based on gclient_factory.py and adds chromium-specific steps.""" |
8 | 8 |
9 import re | 9 import re |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 def FixForGomaWin(options, target, gclient_env): | 32 def FixForGomaWin(options, target, gclient_env): |
33 """Fix gyp variables required for goma on Windows, | 33 """Fix gyp variables required for goma on Windows, |
34 unless it is already set. | 34 unless it is already set. |
35 | 35 |
36 Args: | 36 Args: |
37 options: a list of string for factory options. | 37 options: a list of string for factory options. |
38 target: a string of build target (e.g. Debug, Release). | 38 target: a string of build target (e.g. Debug, Release). |
39 gclient_env: a dict for gclient_env. | 39 gclient_env: a dict for gclient_env. |
40 """ | 40 """ |
41 options = options or {} | 41 options = options or {} |
42 if (not '--compiler=goma' in options and | 42 if ('--compiler=goma' not in options and |
43 not '--compiler=goma-clang' in options): | 43 '--compiler=goma-clang' not in options): |
44 return | 44 return |
45 gyp_defines = gclient_env.get('GYP_DEFINES', '') | 45 gyp_defines = gclient_env.get('GYP_DEFINES', '') |
46 # goma couldn't work with pdbserv. | 46 # goma couldn't work with pdbserv. |
47 if 'fastbuild=1' not in gyp_defines and 'win_z7=1' not in gyp_defines: | 47 if 'fastbuild=1' not in gyp_defines and 'win_z7=1' not in gyp_defines: |
48 if target.startswith('Debug'): | 48 if target.startswith('Debug'): |
49 gyp_defines += ' win_z7=1' | 49 gyp_defines += ' win_z7=1' |
50 else: | 50 else: |
51 gyp_defines += ' fastbuild=1' | 51 gyp_defines += ' fastbuild=1' |
52 # goma couldn't handle precompiled headers. | 52 # goma couldn't handle precompiled headers. |
53 if 'chromium_win_pch=0' not in gyp_defines: | 53 if 'chromium_win_pch=0' not in gyp_defines: |
54 gyp_defines += ' chromium_win_pch=0' | 54 gyp_defines += ' chromium_win_pch=0' |
55 gclient_env['GYP_DEFINES'] = gyp_defines | 55 gclient_env['GYP_DEFINES'] = gyp_defines |
56 | 56 |
57 | 57 |
| 58 def SetGomaGypDefines(options, target, gclient_env): |
| 59 """Adds goma flags to GYP_DEFINES.""" |
| 60 options = options or {} |
| 61 if ('--compiler=goma' not in options and |
| 62 '--compiler=goma-clang' not in options): |
| 63 return |
| 64 # Starting from e.g. C:\b\build\slave\build_slave_path\build, find |
| 65 # C:\b\build\goma. |
| 66 gomadir = os.path.normpath(os.path.join('..', '..', '..', 'goma')) |
| 67 gyp_defines = gclient_env.get('GYP_DEFINES', '') |
| 68 gyp_defines += ' use_goma=1 gomadir=%s' % gomadir |
| 69 gclient_env['GYP_DEFINES'] = gyp_defines |
| 70 |
| 71 |
58 class ChromiumFactory(gclient_factory.GClientFactory): | 72 class ChromiumFactory(gclient_factory.GClientFactory): |
59 """Encapsulates data and methods common to the chromium master.cfg files.""" | 73 """Encapsulates data and methods common to the chromium master.cfg files.""" |
60 | 74 |
61 DEFAULT_TARGET_PLATFORM = config.Master.default_platform | 75 DEFAULT_TARGET_PLATFORM = config.Master.default_platform |
62 | 76 |
63 MEMORY_TOOLS_GYP_DEFINES = 'build_for_tool=memcheck' | 77 MEMORY_TOOLS_GYP_DEFINES = 'build_for_tool=memcheck' |
64 | 78 |
65 # gclient custom vars | 79 # gclient custom vars |
66 CUSTOM_VARS_GOOGLECODE_URL = ('googlecode_url', config.Master.googlecode_url) | 80 CUSTOM_VARS_GOOGLECODE_URL = ('googlecode_url', config.Master.googlecode_url) |
67 CUSTOM_VARS_SOURCEFORGE_URL = ('sourceforge_url', | 81 CUSTOM_VARS_SOURCEFORGE_URL = ('sourceforge_url', |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 # revision in their filename. For this to work correctly, the testers | 961 # revision in their filename. For this to work correctly, the testers |
948 # need to be on a Triggerable that's activated by their builder. | 962 # need to be on a Triggerable that's activated by their builder. |
949 factory_properties.setdefault('webkit_dir', 'third_party/WebKit/Source') | 963 factory_properties.setdefault('webkit_dir', 'third_party/WebKit/Source') |
950 | 964 |
951 factory_properties['gclient_env'] = \ | 965 factory_properties['gclient_env'] = \ |
952 factory_properties.get('gclient_env', {}).copy() | 966 factory_properties.get('gclient_env', {}).copy() |
953 # Defaults gyp to VS2010. | 967 # Defaults gyp to VS2010. |
954 if self._target_platform == 'win32': | 968 if self._target_platform == 'win32': |
955 factory_properties['gclient_env'].setdefault('GYP_MSVS_VERSION', '2010') | 969 factory_properties['gclient_env'].setdefault('GYP_MSVS_VERSION', '2010') |
956 FixForGomaWin(options, target, factory_properties['gclient_env']) | 970 FixForGomaWin(options, target, factory_properties['gclient_env']) |
| 971 SetGomaGypDefines(options, target, factory_properties['gclient_env']): |
957 tests = tests or [] | 972 tests = tests or [] |
958 | 973 |
959 if factory_properties.get('needs_valgrind'): | 974 if factory_properties.get('needs_valgrind'): |
960 self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_VALGRIND] | 975 self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_VALGRIND] |
961 elif factory_properties.get('needs_tsan_win'): | 976 elif factory_properties.get('needs_tsan_win'): |
962 self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_TSAN_WIN] | 977 self._solutions[0].custom_deps_list = [self.CUSTOM_DEPS_TSAN_WIN] |
963 elif factory_properties.get('needs_drmemory'): | 978 elif factory_properties.get('needs_drmemory'): |
964 if 'drmemory.DEPS' not in [s.name for s in self._solutions]: | 979 if 'drmemory.DEPS' not in [s.name for s in self._solutions]: |
965 self._solutions.append(gclient_factory.GClientSolution( | 980 self._solutions.append(gclient_factory.GClientSolution( |
966 config.Master.trunk_url + | 981 config.Master.trunk_url + |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 mode=None, slave_type='BuilderTester', options=None, | 1390 mode=None, slave_type='BuilderTester', options=None, |
1376 compile_timeout=1200, build_url=None, project=None, | 1391 compile_timeout=1200, build_url=None, project=None, |
1377 factory_properties=None): | 1392 factory_properties=None): |
1378 # Make sure the solution is not already there. | 1393 # Make sure the solution is not already there. |
1379 if 'cros_deps' not in [s.name for s in self._solutions]: | 1394 if 'cros_deps' not in [s.name for s in self._solutions]: |
1380 self._solutions.append(gclient_factory.GClientSolution( | 1395 self._solutions.append(gclient_factory.GClientSolution( |
1381 config.Master.trunk_url + '/src/tools/cros.DEPS', name='cros_deps')) | 1396 config.Master.trunk_url + '/src/tools/cros.DEPS', name='cros_deps')) |
1382 return self.ChromiumFactory(target, clobber, tests, mode, slave_type, | 1397 return self.ChromiumFactory(target, clobber, tests, mode, slave_type, |
1383 options, compile_timeout, build_url, project, | 1398 options, compile_timeout, build_url, project, |
1384 factory_properties) | 1399 factory_properties) |
OLD | NEW |