| OLD | NEW |
| 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 |
| 11 # Because of the way that we use decorators, pylint can't figure out the proper | 11 # Because of the way that we use decorators, pylint can't figure out the proper |
| 12 # type signature of functions annotated with the @config_ctx decorator. | 12 # type signature of functions annotated with the @config_ctx decorator. |
| 13 # pylint: disable=E1123 | 13 # pylint: disable=E1123 |
| 14 | 14 |
| 15 HOST_PLATFORMS = ('linux', 'win', 'mac') | 15 HOST_PLATFORMS = ('linux', 'win', 'mac') |
| 16 TARGET_PLATFORMS = HOST_PLATFORMS + ('ios', 'android', 'chromeos') | 16 TARGET_PLATFORMS = HOST_PLATFORMS + ('ios', 'android', 'chromeos') |
| 17 HOST_TARGET_BITS = (32, 64) | 17 HOST_TARGET_BITS = (32, 64) |
| 18 HOST_ARCHS = ('intel',) | 18 HOST_ARCHS = ('intel',) |
| 19 TARGET_ARCHS = HOST_ARCHS + ('arm', 'mips', 'mipsel') | 19 TARGET_ARCHS = HOST_ARCHS + ('arm', 'mips', 'mipsel') |
| 20 TARGET_CROS_BOARDS = (None, 'x86-generic') | 20 TARGET_CROS_BOARDS = (None, 'x86-generic') |
| 21 BUILD_CONFIGS = ('Release', 'Debug', 'Coverage') | 21 BUILD_CONFIGS = ('Release', 'Debug', 'Coverage') |
| 22 MEMORY_TOOLS = ('memcheck', 'drmemory_full', 'drmemory_light') | |
| 23 PROJECT_GENERATORS = ('gyp', 'gn', 'mb') | 22 PROJECT_GENERATORS = ('gyp', 'gn', 'mb') |
| 24 | 23 |
| 25 def check(val, potentials): | 24 def check(val, potentials): |
| 26 assert val in potentials, (val, potentials) | 25 assert val in potentials, (val, potentials) |
| 27 return val | 26 return val |
| 28 | 27 |
| 29 # Schema for config items in this module. | 28 # Schema for config items in this module. |
| 30 def BaseConfig(HOST_PLATFORM, HOST_ARCH, HOST_BITS, | 29 def BaseConfig(HOST_PLATFORM, HOST_ARCH, HOST_BITS, |
| 31 TARGET_PLATFORM, TARGET_ARCH, TARGET_BITS, | 30 TARGET_PLATFORM, TARGET_ARCH, TARGET_BITS, |
| 32 BUILD_CONFIG, TARGET_CROS_BOARD, | 31 BUILD_CONFIG, TARGET_CROS_BOARD, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 project_generator = ConfigGroup( | 74 project_generator = ConfigGroup( |
| 76 tool = Single(basestring, empty_val='gyp'), | 75 tool = Single(basestring, empty_val='gyp'), |
| 77 args = Set(basestring), | 76 args = Set(basestring), |
| 78 ), | 77 ), |
| 79 build_dir = Single(Path), | 78 build_dir = Single(Path), |
| 80 cros_sdk = ConfigGroup( | 79 cros_sdk = ConfigGroup( |
| 81 external = Single(bool, empty_val=True, required=False), | 80 external = Single(bool, empty_val=True, required=False), |
| 82 args = List(basestring), | 81 args = List(basestring), |
| 83 ), | 82 ), |
| 84 runtests = ConfigGroup( | 83 runtests = ConfigGroup( |
| 85 memory_tool = Single(basestring, required=False), | 84 enable_memcheck = Single(bool, empty_val=False, required=False), |
| 86 memory_tests_runner = Single(Path), | 85 memory_tests_runner = Single(Path), |
| 87 enable_lsan = Single(bool, empty_val=False, required=False), | 86 enable_lsan = Single(bool, empty_val=False, required=False), |
| 88 test_args = List(basestring), | 87 test_args = List(basestring), |
| 89 run_asan_test = Single(bool, required=False), | 88 run_asan_test = Single(bool, required=False), |
| 90 swarming_extra_args = List(basestring), | 89 swarming_extra_args = List(basestring), |
| 91 swarming_tags = Set(basestring), | 90 swarming_tags = Set(basestring), |
| 92 ), | 91 ), |
| 93 | 92 |
| 94 # Some platforms do not have a 1:1 correlation of BUILD_CONFIG to what is | 93 # Some platforms do not have a 1:1 correlation of BUILD_CONFIG to what is |
| 95 # passed as --target on the command line. | 94 # passed as --target on the command line. |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 raise BadConf('ubsan_vptr requires clang') | 447 raise BadConf('ubsan_vptr requires clang') |
| 449 c.gn_args.append('is_ubsan_vptr=true') | 448 c.gn_args.append('is_ubsan_vptr=true') |
| 450 c.gyp_env.GYP_DEFINES['ubsan_vptr'] = 1 | 449 c.gyp_env.GYP_DEFINES['ubsan_vptr'] = 1 |
| 451 | 450 |
| 452 @config_ctx() | 451 @config_ctx() |
| 453 def prebuilt_instrumented_libraries(c): | 452 def prebuilt_instrumented_libraries(c): |
| 454 c.gyp_env.GYP_DEFINES['use_prebuilt_instrumented_libraries'] = 1 | 453 c.gyp_env.GYP_DEFINES['use_prebuilt_instrumented_libraries'] = 1 |
| 455 | 454 |
| 456 @config_ctx(group='memory_tool') | 455 @config_ctx(group='memory_tool') |
| 457 def memcheck(c): | 456 def memcheck(c): |
| 458 _memory_tool(c, 'memcheck') | 457 c.runtests.enable_memcheck = True |
| 459 c.gyp_env.GYP_DEFINES['build_for_tool'] = 'memcheck' | 458 c.gyp_env.GYP_DEFINES['build_for_tool'] = 'memcheck' |
| 460 | 459 |
| 461 @config_ctx(deps=['compiler'], group='memory_tool') | 460 @config_ctx(deps=['compiler'], group='memory_tool') |
| 462 def tsan2(c): | 461 def tsan2(c): |
| 463 if 'clang' not in c.compile_py.compiler: # pragma: no cover | 462 if 'clang' not in c.compile_py.compiler: # pragma: no cover |
| 464 raise BadConf('tsan2 requires clang') | 463 raise BadConf('tsan2 requires clang') |
| 465 c.runtests.swarming_tags |= {'tsan:1'} | 464 c.runtests.swarming_tags |= {'tsan:1'} |
| 466 c.gn_args.append('is_tsan=true') | 465 c.gn_args.append('is_tsan=true') |
| 467 gyp_defs = c.gyp_env.GYP_DEFINES | 466 gyp_defs = c.gyp_env.GYP_DEFINES |
| 468 gyp_defs['tsan'] = 1 | 467 gyp_defs['tsan'] = 1 |
| 469 gyp_defs['disable_nacl'] = 1 | 468 gyp_defs['disable_nacl'] = 1 |
| 470 | 469 |
| 471 @config_ctx() | 470 @config_ctx() |
| 472 def syzyasan_compile_only(c): | 471 def syzyasan_compile_only(c): |
| 473 gyp_defs = c.gyp_env.GYP_DEFINES | 472 gyp_defs = c.gyp_env.GYP_DEFINES |
| 474 gyp_defs['syzyasan'] = 1 | 473 gyp_defs['syzyasan'] = 1 |
| 475 gyp_defs['win_z7'] = 0 | 474 gyp_defs['win_z7'] = 0 |
| 476 | 475 |
| 477 @config_ctx( | 476 @config_ctx( |
| 478 deps=['compiler'], group='memory_tool', includes=['syzyasan_compile_only']) | 477 deps=['compiler'], group='memory_tool', includes=['syzyasan_compile_only']) |
| 479 def syzyasan(c): | 478 def syzyasan(c): |
| 480 if c.gyp_env.GYP_DEFINES['component'] != 'static_library': # pragma: no cover | 479 if c.gyp_env.GYP_DEFINES['component'] != 'static_library': # pragma: no cover |
| 481 raise BadConf('SyzyASan requires component=static_library') | 480 raise BadConf('SyzyASan requires component=static_library') |
| 482 gyp_defs = c.gyp_env.GYP_DEFINES | 481 gyp_defs = c.gyp_env.GYP_DEFINES |
| 483 gyp_defs['win_z7'] = 1 | 482 gyp_defs['win_z7'] = 1 |
| 484 gyp_defs['chromium_win_pch'] = 0 | 483 gyp_defs['chromium_win_pch'] = 0 |
| 485 | 484 |
| 486 @config_ctx(group='memory_tool') | |
| 487 def drmemory_full(c): | |
| 488 _memory_tool(c, 'drmemory_full') | |
| 489 c.gyp_env.GYP_DEFINES['build_for_tool'] = 'drmemory' | |
| 490 | |
| 491 @config_ctx(group='memory_tool') | |
| 492 def drmemory_light(c): | |
| 493 _memory_tool(c, 'drmemory_light') | |
| 494 c.gyp_env.GYP_DEFINES['build_for_tool'] = 'drmemory' | |
| 495 | |
| 496 def _memory_tool(c, tool): | |
| 497 if tool not in MEMORY_TOOLS: # pragma: no cover | |
| 498 raise BadConf('"%s" is not a supported memory tool, the supported ones ' | |
| 499 'are: %s' % (tool, ','.join(MEMORY_TOOLS))) | |
| 500 c.runtests.memory_tool = tool | |
| 501 | |
| 502 @config_ctx() | 485 @config_ctx() |
| 503 def lto(c): | 486 def lto(c): |
| 504 c.lto = True | 487 c.lto = True |
| 505 | 488 |
| 506 @config_ctx(includes=['lto']) | 489 @config_ctx(includes=['lto']) |
| 507 def cfi_vptr(c): | 490 def cfi_vptr(c): |
| 508 c.gyp_env.GYP_DEFINES['cfi_vptr'] = 1 | 491 c.gyp_env.GYP_DEFINES['cfi_vptr'] = 1 |
| 509 c.gyp_env.GYP_LINK_CONCURRENCY = 8 | 492 c.gyp_env.GYP_LINK_CONCURRENCY = 8 |
| 510 | 493 |
| 511 @config_ctx() | 494 @config_ctx() |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 def cast_linux(c): | 787 def cast_linux(c): |
| 805 c.gyp_env.GYP_DEFINES['chromecast'] = 1 | 788 c.gyp_env.GYP_DEFINES['chromecast'] = 1 |
| 806 | 789 |
| 807 @config_ctx() | 790 @config_ctx() |
| 808 def internal_gles2_conform_tests(c): | 791 def internal_gles2_conform_tests(c): |
| 809 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 | 792 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 |
| 810 | 793 |
| 811 @config_ctx() | 794 @config_ctx() |
| 812 def build_angle_deqp_tests(c): | 795 def build_angle_deqp_tests(c): |
| 813 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 | 796 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 |
| OLD | NEW |