Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Side by Side Diff: scripts/slave/recipe_modules/chromium/config.py

Issue 1923883003: build: use class path bases, not strings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import pipes 5 import pipes
6 6
7 from recipe_engine.config import config_item_context, ConfigGroup 7 from recipe_engine.config import config_item_context, ConfigGroup
8 from recipe_engine.config import Dict, List, Single, Static, Set, BadConf 8 from recipe_engine.config import Dict, List, Single, Static, Set, BadConf
9 from recipe_engine.config_types import Path 9 from recipe_engine.config_types import Path
10 10
(...skipping 11 matching lines...) Expand all
22 MEMORY_TOOLS = ('memcheck', 'drmemory_full', 'drmemory_light') 22 MEMORY_TOOLS = ('memcheck', 'drmemory_full', 'drmemory_light')
23 PROJECT_GENERATORS = ('gyp', 'gn', 'mb') 23 PROJECT_GENERATORS = ('gyp', 'gn', 'mb')
24 24
25 def check(val, potentials): 25 def check(val, potentials):
26 assert val in potentials, (val, potentials) 26 assert val in potentials, (val, potentials)
27 return val 27 return val
28 28
29 # Schema for config items in this module. 29 # Schema for config items in this module.
30 def BaseConfig(HOST_PLATFORM, HOST_ARCH, HOST_BITS, 30 def BaseConfig(HOST_PLATFORM, HOST_ARCH, HOST_BITS,
31 TARGET_PLATFORM, TARGET_ARCH, TARGET_BITS, 31 TARGET_PLATFORM, TARGET_ARCH, TARGET_BITS,
32 BUILD_CONFIG, TARGET_CROS_BOARD, **_kwargs): 32 BUILD_CONFIG, TARGET_CROS_BOARD,
33 BUILD_PATH, CHECKOUT_PATH, **_kwargs):
33 equal_fn = lambda tup: ('%s=%s' % (tup[0], pipes.quote(str(tup[1])))) 34 equal_fn = lambda tup: ('%s=%s' % (tup[0], pipes.quote(str(tup[1]))))
34 return ConfigGroup( 35 return ConfigGroup(
35 compile_py = ConfigGroup( 36 compile_py = ConfigGroup(
36 default_targets = Set(basestring), 37 default_targets = Set(basestring),
37 build_args = Single(basestring, required=False), 38 build_args = Single(basestring, required=False),
38 build_tool = Single(basestring, required=False), 39 build_tool = Single(basestring, required=False),
39 cross_tool = Single(basestring, required=False), 40 cross_tool = Single(basestring, required=False),
40 compiler = Single(basestring, required=False), 41 compiler = Single(basestring, required=False),
41 mode = Single(basestring, required=False), 42 mode = Single(basestring, required=False),
42 goma_dir = Single(Path, required=False), 43 goma_dir = Single(Path, required=False),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 104
104 HOST_PLATFORM = Static(check(HOST_PLATFORM, HOST_PLATFORMS)), 105 HOST_PLATFORM = Static(check(HOST_PLATFORM, HOST_PLATFORMS)),
105 HOST_ARCH = Static(check(HOST_ARCH, HOST_ARCHS)), 106 HOST_ARCH = Static(check(HOST_ARCH, HOST_ARCHS)),
106 HOST_BITS = Static(check(HOST_BITS, HOST_TARGET_BITS)), 107 HOST_BITS = Static(check(HOST_BITS, HOST_TARGET_BITS)),
107 108
108 TARGET_PLATFORM = Static(check(TARGET_PLATFORM, TARGET_PLATFORMS)), 109 TARGET_PLATFORM = Static(check(TARGET_PLATFORM, TARGET_PLATFORMS)),
109 TARGET_ARCH = Static(check(TARGET_ARCH, TARGET_ARCHS)), 110 TARGET_ARCH = Static(check(TARGET_ARCH, TARGET_ARCHS)),
110 TARGET_BITS = Static(check(TARGET_BITS, HOST_TARGET_BITS)), 111 TARGET_BITS = Static(check(TARGET_BITS, HOST_TARGET_BITS)),
111 TARGET_CROS_BOARD = Static(TARGET_CROS_BOARD), 112 TARGET_CROS_BOARD = Static(TARGET_CROS_BOARD),
112 113
114 BUILD_PATH = Static(BUILD_PATH),
115 CHECKOUT_PATH = Static(CHECKOUT_PATH),
116
113 gn_args = List(basestring), 117 gn_args = List(basestring),
114 118
115 lto = Single(bool, empty_val=False, required=False), 119 lto = Single(bool, empty_val=False, required=False),
116 ) 120 )
117 121
118 config_ctx = config_item_context(BaseConfig) 122 config_ctx = config_item_context(BaseConfig)
119 123
120 124
121 @config_ctx(is_root=True) 125 @config_ctx(is_root=True)
122 def BASE(c): 126 def BASE(c):
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 if c.HOST_BITS < c.TARGET_BITS: 163 if c.HOST_BITS < c.TARGET_BITS:
160 raise BadConf('host bits < targ bits') # pragma: no cover 164 raise BadConf('host bits < targ bits') # pragma: no cover
161 165
162 c.build_config_fs = c.BUILD_CONFIG 166 c.build_config_fs = c.BUILD_CONFIG
163 if c.HOST_PLATFORM == 'win': 167 if c.HOST_PLATFORM == 'win':
164 if c.TARGET_BITS == 64: 168 if c.TARGET_BITS == 64:
165 # Windows requires 64-bit builds to be in <dir>_x64. 169 # Windows requires 64-bit builds to be in <dir>_x64.
166 c.build_config_fs = c.BUILD_CONFIG + '_x64' 170 c.build_config_fs = c.BUILD_CONFIG + '_x64'
167 171
168 # Test runner memory tools that are not compile-time based. 172 # Test runner memory tools that are not compile-time based.
169 c.runtests.memory_tests_runner = Path('[CHECKOUT]', 'tools', 'valgrind', 173 c.runtests.memory_tests_runner = c.CHECKOUT_PATH.join(
170 'chrome_tests', 174 'tools', 'valgrind', 'chrome_tests',
171 platform_ext={'win': '.bat', 175 platform_ext={'win': '.bat', 'mac': '.sh', 'linux': '.sh'})
172 'mac': '.sh',
173 'linux': '.sh'})
174 176
175 if c.project_generator.tool not in PROJECT_GENERATORS: # pragma: no cover 177 if c.project_generator.tool not in PROJECT_GENERATORS: # pragma: no cover
176 raise BadConf('"%s" is not a supported project generator tool, the ' 178 raise BadConf('"%s" is not a supported project generator tool, the '
177 'supported ones are: %s' % (c.project_generator.tool, 179 'supported ones are: %s' % (c.project_generator.tool,
178 ','.join(PROJECT_GENERATORS))) 180 ','.join(PROJECT_GENERATORS)))
179 gyp_arch = { 181 gyp_arch = {
180 ('intel', 32): 'ia32', 182 ('intel', 32): 'ia32',
181 ('intel', 64): 'x64', 183 ('intel', 64): 'x64',
182 ('arm', 32): 'arm', 184 ('arm', 32): 'arm',
183 ('arm', 64): 'arm64', 185 ('arm', 64): 'arm64',
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 @config_ctx(group='builder') 228 @config_ctx(group='builder')
227 def ninja(c): 229 def ninja(c):
228 if c.TARGET_PLATFORM == 'ios': 230 if c.TARGET_PLATFORM == 'ios':
229 c.gyp_env.GYP_GENERATORS.add('ninja') 231 c.gyp_env.GYP_GENERATORS.add('ninja')
230 232
231 c.compile_py.build_tool = 'ninja' 233 c.compile_py.build_tool = 'ninja'
232 234
233 out_path = 'out' 235 out_path = 'out'
234 if c.TARGET_CROS_BOARD: 236 if c.TARGET_CROS_BOARD:
235 out_path += '_%s' % (c.TARGET_CROS_BOARD,) 237 out_path += '_%s' % (c.TARGET_CROS_BOARD,)
236 c.build_dir = Path('[CHECKOUT]', out_path) 238 c.build_dir = c.CHECKOUT_PATH.join(out_path)
237 239
238 @config_ctx() 240 @config_ctx()
239 def msvs2010(c): 241 def msvs2010(c):
240 c.gyp_env.GYP_MSVS_VERSION = '2010' 242 c.gyp_env.GYP_MSVS_VERSION = '2010'
241 243
242 @config_ctx() 244 @config_ctx()
243 def msvs2012(c): 245 def msvs2012(c):
244 c.gyp_env.GYP_MSVS_VERSION = '2012' 246 c.gyp_env.GYP_MSVS_VERSION = '2012'
245 247
246 @config_ctx() 248 @config_ctx()
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 306
305 if not c.compile_py.compiler: 307 if not c.compile_py.compiler:
306 c.compile_py.compiler = 'goma' 308 c.compile_py.compiler = 'goma'
307 elif c.compile_py.compiler == 'clang': 309 elif c.compile_py.compiler == 'clang':
308 c.compile_py.compiler = 'goma-clang' 310 c.compile_py.compiler = 'goma-clang'
309 else: # pragma: no cover 311 else: # pragma: no cover
310 raise BadConf('goma config doesn\'t understand %s' % c.compile_py.compiler) 312 raise BadConf('goma config doesn\'t understand %s' % c.compile_py.compiler)
311 313
312 c.gyp_env.GYP_DEFINES['use_goma'] = 1 314 c.gyp_env.GYP_DEFINES['use_goma'] = 1
313 315
314 goma_dir = Path('[BUILD]', 'goma') 316 goma_dir = c.BUILD_PATH.join('goma')
315 c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir 317 c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir
316 c.compile_py.goma_dir = goma_dir 318 c.compile_py.goma_dir = goma_dir
317 319
318 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': 320 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang':
319 fastbuild(c) 321 fastbuild(c)
320 pch(c, invert=True) 322 pch(c, invert=True)
321 323
322 @config_ctx() 324 @config_ctx()
323 def pch(c, invert=False): 325 def pch(c, invert=False):
324 if c.TARGET_PLATFORM == 'win': 326 if c.TARGET_PLATFORM == 'win':
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 c.compile_py.default_targets = ['All', 'chromium_builder_tests'] 671 c.compile_py.default_targets = ['All', 'chromium_builder_tests']
670 672
671 @config_ctx(includes=['ninja', 'clang', 'cfi_vptr']) 673 @config_ctx(includes=['ninja', 'clang', 'cfi_vptr'])
672 def chromium_cfi(c): 674 def chromium_cfi(c):
673 c.compile_py.default_targets = ['All'] 675 c.compile_py.default_targets = ['All']
674 676
675 @config_ctx(includes=['xcode', 'static_library']) 677 @config_ctx(includes=['xcode', 'static_library'])
676 def chromium_xcode(c): # pragma: no cover 678 def chromium_xcode(c): # pragma: no cover
677 c.compile_py.build_tool = 'xcode' 679 c.compile_py.build_tool = 'xcode'
678 c.compile_py.default_targets = ['All'] 680 c.compile_py.default_targets = ['All']
679 c.compile_py.xcode_project = Path('[CHECKOUT]', 'build', 'all.xcodeproj') 681 c.compile_py.xcode_project = c.CHECKOUT_PATH.join('build', 'all.xcodeproj')
680 682
681 @config_ctx(includes=['chromium', 'official']) 683 @config_ctx(includes=['chromium', 'official'])
682 def chromium_official(c): 684 def chromium_official(c):
683 # TODO(phajdan.jr): Unify compile targets used by official builders. 685 # TODO(phajdan.jr): Unify compile targets used by official builders.
684 if c.TARGET_PLATFORM == 'win': 686 if c.TARGET_PLATFORM == 'win':
685 c.compile_py.default_targets = ['chrome_official_builder'] 687 c.compile_py.default_targets = ['chrome_official_builder']
686 elif c.TARGET_PLATFORM in ['linux', 'mac']: 688 elif c.TARGET_PLATFORM in ['linux', 'mac']:
687 c.compile_py.default_targets = [] 689 c.compile_py.default_targets = []
688 690
689 @config_ctx(includes=['chromium']) 691 @config_ctx(includes=['chromium'])
(...skipping 28 matching lines...) Expand all
718 # See https://www.chromium.org/developers/testing/addresssanitizer. 720 # See https://www.chromium.org/developers/testing/addresssanitizer.
719 pass 721 pass
720 722
721 @config_ctx() 723 @config_ctx()
722 def android_common(c): 724 def android_common(c):
723 gyp_defs = c.gyp_env.GYP_DEFINES 725 gyp_defs = c.gyp_env.GYP_DEFINES
724 gyp_defs['fastbuild'] = 1 726 gyp_defs['fastbuild'] = 1
725 gyp_defs['OS'] = 'android' 727 gyp_defs['OS'] = 'android'
726 728
727 c.env.PATH.extend([ 729 c.env.PATH.extend([
728 Path('[CHECKOUT]', 'third_party', 'android_tools', 'sdk', 730 c.CHECKOUT_PATH.join(
729 'platform-tools'), 731 'third_party', 'android_tools', 'sdk', 'platform-tools'),
730 Path('[CHECKOUT]', 'build', 'android')]) 732 c.CHECKOUT_PATH.join('build', 'android')])
731 733
732 @config_ctx() 734 @config_ctx()
733 def android_findbugs(c): 735 def android_findbugs(c):
734 c.gyp_env.GYP_DEFINES['run_findbugs'] = 1 736 c.gyp_env.GYP_DEFINES['run_findbugs'] = 1
735 737
736 @config_ctx(includes=['ninja', 'shared_library', 'clang', 'goma']) 738 @config_ctx(includes=['ninja', 'shared_library', 'clang', 'goma'])
737 def codesearch(c): 739 def codesearch(c):
738 # -k 0 prevents stopping on errors, so the compile step tries to do as much as 740 # -k 0 prevents stopping on errors, so the compile step tries to do as much as
739 # possible. 741 # possible.
740 c.compile_py.build_args = '-k 0' 742 c.compile_py.build_args = '-k 0'
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 def internal_gles2_conform_tests(c): 795 def internal_gles2_conform_tests(c):
794 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 796 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1
795 797
796 @config_ctx() 798 @config_ctx()
797 def build_angle_deqp_tests(c): 799 def build_angle_deqp_tests(c):
798 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 800 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1
799 801
800 @config_ctx() 802 @config_ctx()
801 def force_mac_toolchain(c): 803 def force_mac_toolchain(c):
802 c.env.FORCE_MAC_TOOLCHAIN = 1 804 c.env.FORCE_MAC_TOOLCHAIN = 1
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/chromium/api.py ('k') | scripts/slave/recipe_modules/chromium_android/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698