From 0cba9481fb068b16bcfdfa1f66ea97b7d0dc27ab Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 25 Aug 2016 14:36:39 +0300 Subject: [PATCH] Change official debug builds to release + dcheck_always_on (issue #1961) --- tools/gn_args.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/tools/gn_args.py b/tools/gn_args.py index 959f12af8..2dc0d6ff2 100644 --- a/tools/gn_args.py +++ b/tools/gn_args.py @@ -195,6 +195,10 @@ def ValidateArgs(args): if not dcheck_always_on: msg('is_asan=true recommends dcheck_always_on=true') + # Official build requires Release builds. + if is_official_build: + assert not is_debug, "is_official_build=true requires is_debug=false" + if platform == 'windows': # Official builds should not use /DEBUG:FASTLINK. if is_official_build: @@ -265,7 +269,18 @@ def GetConfigArgs(args, is_debug, is_x64): """ Return merged GN args for the configuration and validate. """ - result = MergeDicts(args, { + add_args = {} + + # Cannot create is_official_build=true is_debug=true builds. + # This restriction is enforced in //build/config/BUILDCONFIG.gn. + # Instead, our "official Debug" build is a Release build with dchecks and + # symbols. Symbols will be generated by default for official builds; see the + # definition of 'symbol_level' in //build/config/compiler/compiler.gni. + if is_debug and GetArgValue(args, 'is_official_build'): + is_debug = False + add_args['dcheck_always_on'] = True + + result = MergeDicts(args, add_args, { 'is_debug': is_debug, 'target_cpu': 'x64' if is_x64 else 'x86', }) @@ -281,20 +296,22 @@ def GetAllPlatformConfigs(build_args): # Merged args without validation. args = GetMergedArgs(build_args) + create_debug = True + # Don't create debug directories for asan builds. - is_asan = GetArgValue(args, 'is_asan') - if is_asan: - msg('Only generating Release configuration due to is_asan=true') + if GetArgValue(args, 'is_asan'): + create_debug = False + msg('Not generating Debug configuration due to is_asan=true') # Always create x64 configs. - if not is_asan: + if create_debug: result['Debug_GN_x64'] = GetConfigArgs(args, True, True) result['Release_GN_x64'] = GetConfigArgs(args, False, True) # Create x86 configs on Windows and on Linux when using the sysroot. if platform == 'windows' or \ (platform == 'linux' and GetArgValue(args, 'use_sysroot') == True): - if not is_asan: + if create_debug: result['Debug_GN_x86'] = GetConfigArgs(args, True, False) result['Release_GN_x86'] = GetConfigArgs(args, False, False)