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