| 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 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 @config_ctx() | 238 @config_ctx() |
| 239 def msvs2010(c): | 239 def msvs2010(c): |
| 240 c.gyp_env.GYP_MSVS_VERSION = '2010' | 240 c.gyp_env.GYP_MSVS_VERSION = '2010' |
| 241 | 241 |
| 242 @config_ctx() | 242 @config_ctx() |
| 243 def msvs2012(c): | 243 def msvs2012(c): |
| 244 c.gyp_env.GYP_MSVS_VERSION = '2012' | 244 c.gyp_env.GYP_MSVS_VERSION = '2012' |
| 245 | 245 |
| 246 @config_ctx() | 246 @config_ctx() |
| 247 def msvs2013(c): | 247 def msvs2013(c): |
| 248 c.gn_args.append('visual_studio_version=2013') |
| 248 c.gyp_env.GYP_MSVS_VERSION = '2013' | 249 c.gyp_env.GYP_MSVS_VERSION = '2013' |
| 249 | 250 |
| 250 @config_ctx() | 251 @config_ctx() |
| 251 def msvs2015(c): | 252 def msvs2015(c): |
| 253 c.gn_args.append('visual_studio_version=2015') |
| 252 c.gyp_env.GYP_MSVS_VERSION = '2015' | 254 c.gyp_env.GYP_MSVS_VERSION = '2015' |
| 253 | 255 |
| 254 @config_ctx() | 256 @config_ctx() |
| 255 def goma_canary(c): | 257 def goma_canary(c): |
| 256 c.compile_py.goma_canary = True | 258 c.compile_py.goma_canary = True |
| 257 c.compile_py.goma_hermetic = 'error' | 259 c.compile_py.goma_hermetic = 'error' |
| 258 c.compile_py.goma_failfast = True | 260 c.compile_py.goma_failfast = True |
| 259 | 261 |
| 260 @config_ctx() | 262 @config_ctx() |
| 261 def goma_staging(c): | 263 def goma_staging(c): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 276 c.compile_py.ninja_confirm_noop = True | 278 c.compile_py.ninja_confirm_noop = True |
| 277 | 279 |
| 278 @config_ctx(group='builder') | 280 @config_ctx(group='builder') |
| 279 def xcode(c): # pragma: no cover | 281 def xcode(c): # pragma: no cover |
| 280 if c.HOST_PLATFORM != 'mac': | 282 if c.HOST_PLATFORM != 'mac': |
| 281 raise BadConf('can not use xcodebuild on "%s"' % c.HOST_PLATFORM) | 283 raise BadConf('can not use xcodebuild on "%s"' % c.HOST_PLATFORM) |
| 282 c.gyp_env.GYP_GENERATORS.add('xcode') | 284 c.gyp_env.GYP_GENERATORS.add('xcode') |
| 283 | 285 |
| 284 def _clang_common(c): | 286 def _clang_common(c): |
| 285 c.compile_py.compiler = 'clang' | 287 c.compile_py.compiler = 'clang' |
| 288 c.gn_args.append('is_clang=true') |
| 286 c.gyp_env.GYP_DEFINES['clang'] = 1 | 289 c.gyp_env.GYP_DEFINES['clang'] = 1 |
| 287 | 290 |
| 288 @config_ctx(group='compiler') | 291 @config_ctx(group='compiler') |
| 289 def clang(c): | 292 def clang(c): |
| 290 _clang_common(c) | 293 _clang_common(c) |
| 291 | 294 |
| 292 @config_ctx(group='compiler') | 295 @config_ctx(group='compiler') |
| 293 def gcc(c): | 296 def gcc(c): |
| 297 c.gn_args.append('is_clang=false') |
| 294 c.gyp_env.GYP_DEFINES['clang'] = 0 | 298 c.gyp_env.GYP_DEFINES['clang'] = 0 |
| 295 | 299 |
| 296 @config_ctx(group='compiler') | 300 @config_ctx(group='compiler') |
| 297 def default_compiler(c): | 301 def default_compiler(c): |
| 298 if c.TARGET_PLATFORM in ('mac', 'ios'): | 302 if c.TARGET_PLATFORM in ('mac', 'ios'): |
| 299 _clang_common(c) | 303 _clang_common(c) |
| 300 | 304 |
| 301 @config_ctx(deps=['compiler', 'builder'], group='distributor') | 305 @config_ctx(deps=['compiler', 'builder'], group='distributor') |
| 302 def goma(c): | 306 def goma(c): |
| 303 if not c.compile_py.compiler: | 307 if not c.compile_py.compiler: |
| 304 c.compile_py.compiler = 'goma' | 308 c.compile_py.compiler = 'goma' |
| 305 elif c.compile_py.compiler == 'clang': | 309 elif c.compile_py.compiler == 'clang': |
| 306 c.compile_py.compiler = 'goma-clang' | 310 c.compile_py.compiler = 'goma-clang' |
| 307 else: # pragma: no cover | 311 else: # pragma: no cover |
| 308 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) |
| 309 | 313 |
| 310 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': | 314 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': |
| 311 fastbuild(c) | 315 fastbuild(c) |
| 312 | 316 |
| 313 @config_ctx() | 317 @config_ctx() |
| 314 def dcheck(c, invert=False): | 318 def dcheck(c, invert=False): |
| 319 c.gn_args.append('dcheck_always_on=%s' % str(not invert).lower()) |
| 315 c.gyp_env.GYP_DEFINES['dcheck_always_on'] = int(not invert) | 320 c.gyp_env.GYP_DEFINES['dcheck_always_on'] = int(not invert) |
| 316 | 321 |
| 317 @config_ctx() | 322 @config_ctx() |
| 318 def fastbuild(c, invert=False): | 323 def fastbuild(c, invert=False): |
| 324 c.gn_args.append('symbol_level=%d' % (1 if invert else 2)) |
| 319 c.gyp_env.GYP_DEFINES['fastbuild'] = int(not invert) | 325 c.gyp_env.GYP_DEFINES['fastbuild'] = int(not invert) |
| 320 | 326 |
| 321 @config_ctx() | 327 @config_ctx() |
| 322 def no_dump_symbols(c): | 328 def no_dump_symbols(c): |
| 323 c.gyp_env.GYP_DEFINES['linux_dump_symbols'] = 0 | 329 c.gyp_env.GYP_DEFINES['linux_dump_symbols'] = 0 |
| 324 | 330 |
| 325 @config_ctx() | 331 @config_ctx() |
| 326 def isolation_mode_noop(c): | 332 def isolation_mode_noop(c): |
| 327 c.gyp_env.GYP_DEFINES['test_isolation_mode'] = 'noop' | 333 c.gyp_env.GYP_DEFINES['test_isolation_mode'] = 'noop' |
| 328 | 334 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 | 384 |
| 379 @config_ctx(deps=['compiler']) | 385 @config_ctx(deps=['compiler']) |
| 380 def asan(c): | 386 def asan(c): |
| 381 if 'clang' not in c.compile_py.compiler: # pragma: no cover | 387 if 'clang' not in c.compile_py.compiler: # pragma: no cover |
| 382 raise BadConf('asan requires clang') | 388 raise BadConf('asan requires clang') |
| 383 c.runtests.swarming_tags |= {'asan:1'} | 389 c.runtests.swarming_tags |= {'asan:1'} |
| 384 if c.TARGET_PLATFORM in ['mac', 'win']: | 390 if c.TARGET_PLATFORM in ['mac', 'win']: |
| 385 # Set fastbuild=0 and prevent other configs from changing it. | 391 # Set fastbuild=0 and prevent other configs from changing it. |
| 386 fastbuild(c, invert=True, optional=False) | 392 fastbuild(c, invert=True, optional=False) |
| 387 | 393 |
| 394 c.gn_args.append('is_asan=true') |
| 388 c.gyp_env.GYP_DEFINES['asan'] = 1 | 395 c.gyp_env.GYP_DEFINES['asan'] = 1 |
| 389 if c.TARGET_PLATFORM != 'android' and c.TARGET_BITS == 64: | 396 if c.TARGET_PLATFORM != 'android' and c.TARGET_BITS == 64: |
| 390 # LSAN isn't supported on Android or 32 bits platforms. | 397 # LSAN isn't supported on Android or 32 bits platforms. |
| 398 c.gn_args.append('is_lsan=true') |
| 391 c.gyp_env.GYP_DEFINES['lsan'] = 1 | 399 c.gyp_env.GYP_DEFINES['lsan'] = 1 |
| 392 | 400 |
| 393 @config_ctx(deps=['compiler']) | 401 @config_ctx(deps=['compiler']) |
| 394 def lsan(c): | 402 def lsan(c): |
| 395 c.runtests.enable_lsan = True | 403 c.runtests.enable_lsan = True |
| 396 c.runtests.swarming_extra_args += ['--lsan=1'] | 404 c.runtests.swarming_extra_args += ['--lsan=1'] |
| 397 c.runtests.swarming_tags |= {'lsan:1'} | 405 c.runtests.swarming_tags |= {'lsan:1'} |
| 398 | 406 |
| 399 # TODO(infra,earthdok,glider): Make this a gyp variable. This is also not a | 407 # TODO(infra,earthdok,glider): Make this a gyp variable. This is also not a |
| 400 # good name as only v8 builds release symbolized with -O2 while | 408 # good name as only v8 builds release symbolized with -O2 while |
| 401 # chromium.lkgr uses -O1. | 409 # chromium.lkgr uses -O1. |
| 402 @config_ctx() | 410 @config_ctx() |
| 403 def asan_symbolized(c): | 411 def asan_symbolized(c): |
| 404 c.gyp_env.GYP_DEFINES['release_extra_cflags'] = ( | 412 c.gyp_env.GYP_DEFINES['release_extra_cflags'] = ( |
| 405 '-fno-inline-functions -fno-inline') | 413 '-fno-inline-functions -fno-inline') |
| 406 | 414 |
| 407 @config_ctx() | 415 @config_ctx() |
| 408 def sanitizer_coverage(c): | 416 def sanitizer_coverage(c): |
| 409 c.gyp_env.GYP_DEFINES['sanitizer_coverage'] = 'edge' | 417 c.gyp_env.GYP_DEFINES['sanitizer_coverage'] = 'edge' |
| 410 | 418 |
| 411 @config_ctx(deps=['compiler']) | 419 @config_ctx(deps=['compiler']) |
| 412 def msan(c): | 420 def msan(c): |
| 413 if 'clang' not in c.compile_py.compiler: # pragma: no cover | 421 if 'clang' not in c.compile_py.compiler: # pragma: no cover |
| 414 raise BadConf('msan requires clang') | 422 raise BadConf('msan requires clang') |
| 415 c.runtests.swarming_tags |= {'msan:1'} | 423 c.runtests.swarming_tags |= {'msan:1'} |
| 424 c.gn_args.append('is_msan=true') |
| 416 c.gyp_env.GYP_DEFINES['msan'] = 1 | 425 c.gyp_env.GYP_DEFINES['msan'] = 1 |
| 417 | 426 |
| 418 @config_ctx() | 427 @config_ctx() |
| 419 def msan_no_origin_tracking(c): | 428 def msan_no_origin_tracking(c): |
| 420 # Don't track the chain of stores leading from allocation site to use site. | 429 # Don't track the chain of stores leading from allocation site to use site. |
| 421 c.gyp_env.GYP_DEFINES['msan_track_origins'] = 0 | 430 c.gyp_env.GYP_DEFINES['msan_track_origins'] = 0 |
| 422 | 431 |
| 423 @config_ctx() | 432 @config_ctx() |
| 424 def msan_full_origin_tracking(c): | 433 def msan_full_origin_tracking(c): |
| 425 # Track the chain of stores leading from allocation site to use site. | 434 # Track the chain of stores leading from allocation site to use site. |
| 426 c.gyp_env.GYP_DEFINES['msan_track_origins'] = 2 | 435 c.gyp_env.GYP_DEFINES['msan_track_origins'] = 2 |
| 427 | 436 |
| 428 # This is currently needed to make tests return a non-zero exit code when an | 437 # This is currently needed to make tests return a non-zero exit code when an |
| 429 # UBSan failure happens. | 438 # UBSan failure happens. |
| 430 # TODO(kjellander,samsonov): Remove when the upstream bug | 439 # TODO(kjellander,samsonov): Remove when the upstream bug |
| 431 # (https://llvm.org/bugs/show_bug.cgi?id=25569) is fixed. | 440 # (https://llvm.org/bugs/show_bug.cgi?id=25569) is fixed. |
| 432 @config_ctx() | 441 @config_ctx() |
| 433 def ubsan_fail_on_errors(c): | 442 def ubsan_fail_on_errors(c): |
| 434 c.gyp_env.GYP_DEFINES['release_extra_cflags'] = ( | 443 c.gyp_env.GYP_DEFINES['release_extra_cflags'] = ( |
| 435 '-fno-sanitize-recover=undefined') | 444 '-fno-sanitize-recover=undefined') |
| 436 | 445 |
| 437 @config_ctx(deps=['compiler'], includes=['ubsan_fail_on_errors']) | 446 @config_ctx(deps=['compiler'], includes=['ubsan_fail_on_errors']) |
| 438 def ubsan(c): | 447 def ubsan(c): |
| 439 if 'clang' not in c.compile_py.compiler: # pragma: no cover | 448 if 'clang' not in c.compile_py.compiler: # pragma: no cover |
| 440 raise BadConf('ubsan requires clang') | 449 raise BadConf('ubsan requires clang') |
| 450 c.gn_args.append('is_ubsan=true') |
| 441 c.gyp_env.GYP_DEFINES['ubsan'] = 1 | 451 c.gyp_env.GYP_DEFINES['ubsan'] = 1 |
| 442 | 452 |
| 443 @config_ctx(deps=['compiler'], includes=['ubsan_fail_on_errors']) | 453 @config_ctx(deps=['compiler'], includes=['ubsan_fail_on_errors']) |
| 444 def ubsan_vptr(c): | 454 def ubsan_vptr(c): |
| 445 if 'clang' not in c.compile_py.compiler: # pragma: no cover | 455 if 'clang' not in c.compile_py.compiler: # pragma: no cover |
| 446 raise BadConf('ubsan_vptr requires clang') | 456 raise BadConf('ubsan_vptr requires clang') |
| 457 c.gn_args.append('is_ubsan_vptr=true') |
| 447 c.gyp_env.GYP_DEFINES['ubsan_vptr'] = 1 | 458 c.gyp_env.GYP_DEFINES['ubsan_vptr'] = 1 |
| 448 | 459 |
| 449 @config_ctx() | 460 @config_ctx() |
| 450 def prebuilt_instrumented_libraries(c): | 461 def prebuilt_instrumented_libraries(c): |
| 451 c.gyp_env.GYP_DEFINES['use_prebuilt_instrumented_libraries'] = 1 | 462 c.gyp_env.GYP_DEFINES['use_prebuilt_instrumented_libraries'] = 1 |
| 452 | 463 |
| 453 @config_ctx(group='memory_tool') | 464 @config_ctx(group='memory_tool') |
| 454 def memcheck(c): | 465 def memcheck(c): |
| 455 _memory_tool(c, 'memcheck') | 466 _memory_tool(c, 'memcheck') |
| 456 c.gyp_env.GYP_DEFINES['build_for_tool'] = 'memcheck' | 467 c.gyp_env.GYP_DEFINES['build_for_tool'] = 'memcheck' |
| 457 | 468 |
| 458 @config_ctx(deps=['compiler'], group='memory_tool') | 469 @config_ctx(deps=['compiler'], group='memory_tool') |
| 459 def tsan2(c): | 470 def tsan2(c): |
| 460 if 'clang' not in c.compile_py.compiler: # pragma: no cover | 471 if 'clang' not in c.compile_py.compiler: # pragma: no cover |
| 461 raise BadConf('tsan2 requires clang') | 472 raise BadConf('tsan2 requires clang') |
| 462 c.runtests.swarming_tags |= {'tsan:1'} | 473 c.runtests.swarming_tags |= {'tsan:1'} |
| 474 c.gn_args.append('is_tsan=true') |
| 463 gyp_defs = c.gyp_env.GYP_DEFINES | 475 gyp_defs = c.gyp_env.GYP_DEFINES |
| 464 gyp_defs['tsan'] = 1 | 476 gyp_defs['tsan'] = 1 |
| 465 gyp_defs['disable_nacl'] = 1 | 477 gyp_defs['disable_nacl'] = 1 |
| 466 | 478 |
| 467 @config_ctx() | 479 @config_ctx() |
| 468 def syzyasan_compile_only(c): | 480 def syzyasan_compile_only(c): |
| 469 gyp_defs = c.gyp_env.GYP_DEFINES | 481 gyp_defs = c.gyp_env.GYP_DEFINES |
| 470 gyp_defs['syzyasan'] = 1 | 482 gyp_defs['syzyasan'] = 1 |
| 471 gyp_defs['win_z7'] = 0 | 483 gyp_defs['win_z7'] = 0 |
| 472 | 484 |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 def cast_linux(c): | 812 def cast_linux(c): |
| 801 c.gyp_env.GYP_DEFINES['chromecast'] = 1 | 813 c.gyp_env.GYP_DEFINES['chromecast'] = 1 |
| 802 | 814 |
| 803 @config_ctx() | 815 @config_ctx() |
| 804 def internal_gles2_conform_tests(c): | 816 def internal_gles2_conform_tests(c): |
| 805 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 | 817 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 |
| 806 | 818 |
| 807 @config_ctx() | 819 @config_ctx() |
| 808 def build_angle_deqp_tests(c): | 820 def build_angle_deqp_tests(c): |
| 809 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 | 821 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 |
| OLD | NEW |