parameters: (args)
docstring: Validate GN arg combinations that we know about. Also provide suggestions
    where appropriate.
docstring_summary: Validate GN arg combinations that we know about. Also provide suggestions
    where appropriate.
docstring_tokens: Validate GN arg combinations that we know about . Also provide suggestions where appropriate .
function: def ValidateArgs(args):
    """
    Validate GN arg combinations that we know about. Also provide suggestions
    where appropriate.
    """
    dcheck_always_on = GetArgValue(args, 'dcheck_always_on')
    is_asan = GetArgValue(args, 'is_asan')
    is_debug = GetArgValue(args, 'is_debug')
    is_official_build = GetArgValue(args, 'is_official_build')
    target_cpu = GetArgValue(args, 'target_cpu')
  
    if platform == 'linux':
      use_sysroot = GetArgValue(args, 'use_sysroot')
  
    if platform == 'windows':
      is_win_fastlink = GetArgValue(args, 'is_win_fastlink')
      visual_studio_path = GetArgValue(args, 'visual_studio_path')
      visual_studio_version = GetArgValue(args, 'visual_studio_version')
      visual_studio_runtime_dirs = GetArgValue(args, 'visual_studio_runtime_dirs')
      windows_sdk_path = GetArgValue(args, 'windows_sdk_path')
  
    # Target CPU architecture.
    # - Windows supports "x86" and "x64".
    # - Mac supports only "x64".
    # - Linux supports only "x64" unless using a sysroot environment.
    if platform == 'macosx':
      assert target_cpu == 'x64', 'target_cpu must be "x64"'
    elif platform == 'windows':
      assert target_cpu in ('x86', 'x64'), 'target_cpu must be "x86" or "x64"'
    elif platform == 'linux':
      assert target_cpu in ('x86', 'x64', 'arm'), 'target_cpu must be "x86", "x64" or "arm"'
  
    if platform == 'linux':
      if target_cpu == 'x86':
        assert use_sysroot, 'target_cpu="x86" requires use_sysroot=true'
      elif target_cpu == 'arm':
        assert use_sysroot, 'target_cpu="arm" requires use_sysroot=true'
  
    # ASAN requires Release builds.
    if is_asan:
      assert not is_debug, "is_asan=true requires is_debug=false"
      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:
        assert not is_win_fastlink, "is_official_build=true precludes is_win_fastlink=true"
  
      # Non-official debug builds should use /DEBUG:FASTLINK.
      if not is_official_build and is_debug and not is_win_fastlink:
          msg('is_official_build=false + is_debug=true recommends is_win_fastlink=true')
  
      # Windows custom toolchain requirements.
      #
      # Required GN arguments:
      #   visual_studio_path="<path to VS root>"
      #     The directory that contains Visual Studio. For example, a subset of
      #     "C:\Program Files (x86)\Microsoft Visual Studio 14.0".
      #   visual_studio_version="<VS version>"
      #     The VS version. For example, "2015".
      #   visual_studio_runtime_dirs="<path to VS CRT>"
      #     The directory that contains the VS CRT. For example, the contents of
      #     "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64" plus
      #     "C:\Windows\System32\ucrtbased.dll"
      #   windows_sdk_path="<path to WinSDK>"
      #     The directory that contains the Win SDK. For example, a subset of
      #     "C:\Program Files (x86)\Windows Kits\10".
      #
      # Required environment variables:
      #   DEPOT_TOOLS_WIN_TOOLCHAIN=0
      #   GYP_MSVS_OVERRIDE_PATH=<path to VS root, must match visual_studio_path>
      #   GYP_MSVS_VERSION=<VS version, must match visual_studio_version>
      #   CEF_VCVARS=none
      #   INCLUDE=<VS include paths>
      #   LIB=<VS library paths>
      #   PATH=<VS executable paths>
      #
      # See comments in gclient_hook.py for environment variable usage.
      #
      if visual_studio_path != '':
        assert visual_studio_version != '', 'visual_studio_path requires visual_studio_version'
        assert visual_studio_runtime_dirs != '', 'visual_studio_path requires visual_studio_runtime_dirs'
        assert windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path'
  
        assert os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '') == '0', \
          "visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable"
  
        msvs_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH', '')
        assert msvs_path == visual_studio_path and os.path.exists(msvs_path), \
          "visual_studio_path requires matching GYP_MSVS_OVERRIDE_PATH env variable"
  
        msvs_version = os.environ.get('GYP_MSVS_VERSION', '')
        assert msvs_version == visual_studio_version, \
          "visual_studio_version requires matching GYP_MSVS_VERSION env variable"
  
        assert os.environ.get('CEF_VCVARS', '') == 'none', \
          "visual_studio_path requires CEF_VCVARS=none env variable"
  
        assert 'INCLUDE' in os.environ \
          and 'LIB' in os.environ \
          and 'PATH' in os.environ, \
          "visual_studio_path requires INCLUDE, LIB and PATH env variables"
  
        # If "%GYP_MSVS_OVERRIDE_PATH%\VC\vcvarsall.bat" exists then environment
        # variables will be derived from there and the specified INCLUDE/LIB/PATH
        # values will be ignored by Chromium. If this file does not exist then the
        # INCLUDE/LIB/PATH values are also required by Chromium.
        vcvars_path = os.path.join(msvs_path, 'VC', 'vcvarsall.bat')
        if (os.path.exists(vcvars_path)):
          msg('INCLUDE/LIB/PATH values will be derived from %s' % vcvars_path)
function_tokens: def ValidateArgs ( args ) : dcheck_always_on = GetArgValue ( args , 'dcheck_always_on' ) is_asan = GetArgValue ( args , 'is_asan' ) is_debug = GetArgValue ( args , 'is_debug' ) is_official_build = GetArgValue ( args , 'is_official_build' ) target_cpu = GetArgValue ( args , 'target_cpu' ) if platform == 'linux' : use_sysroot = GetArgValue ( args , 'use_sysroot' ) if platform == 'windows' : is_win_fastlink = GetArgValue ( args , 'is_win_fastlink' ) visual_studio_path = GetArgValue ( args , 'visual_studio_path' ) visual_studio_version = GetArgValue ( args , 'visual_studio_version' ) visual_studio_runtime_dirs = GetArgValue ( args , 'visual_studio_runtime_dirs' ) windows_sdk_path = GetArgValue ( args , 'windows_sdk_path' ) # Target CPU architecture. # - Windows supports "x86" and "x64". # - Mac supports only "x64". # - Linux supports only "x64" unless using a sysroot environment. if platform == 'macosx' : assert target_cpu == 'x64' , 'target_cpu must be "x64"' elif platform == 'windows' : assert target_cpu in ( 'x86' , 'x64' ) , 'target_cpu must be "x86" or "x64"' elif platform == 'linux' : assert target_cpu in ( 'x86' , 'x64' , 'arm' ) , 'target_cpu must be "x86", "x64" or "arm"' if platform == 'linux' : if target_cpu == 'x86' : assert use_sysroot , 'target_cpu="x86" requires use_sysroot=true' elif target_cpu == 'arm' : assert use_sysroot , 'target_cpu="arm" requires use_sysroot=true' # ASAN requires Release builds. if is_asan : assert not is_debug , "is_asan=true requires is_debug=false" 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 : assert not is_win_fastlink , "is_official_build=true precludes is_win_fastlink=true" # Non-official debug builds should use /DEBUG:FASTLINK. if not is_official_build and is_debug and not is_win_fastlink : msg ( 'is_official_build=false + is_debug=true recommends is_win_fastlink=true' ) # Windows custom toolchain requirements. # # Required GN arguments: #   visual_studio_path="<path to VS root>" #     The directory that contains Visual Studio. For example, a subset of #     "C:\Program Files (x86)\Microsoft Visual Studio 14.0". #   visual_studio_version="<VS version>" #     The VS version. For example, "2015". #   visual_studio_runtime_dirs="<path to VS CRT>" #     The directory that contains the VS CRT. For example, the contents of #     "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64" plus #     "C:\Windows\System32\ucrtbased.dll" #   windows_sdk_path="<path to WinSDK>" #     The directory that contains the Win SDK. For example, a subset of #     "C:\Program Files (x86)\Windows Kits\10". # # Required environment variables: #   DEPOT_TOOLS_WIN_TOOLCHAIN=0 #   GYP_MSVS_OVERRIDE_PATH=<path to VS root, must match visual_studio_path> #   GYP_MSVS_VERSION=<VS version, must match visual_studio_version> #   CEF_VCVARS=none #   INCLUDE=<VS include paths> #   LIB=<VS library paths> #   PATH=<VS executable paths> # # See comments in gclient_hook.py for environment variable usage. # if visual_studio_path != '' : assert visual_studio_version != '' , 'visual_studio_path requires visual_studio_version' assert visual_studio_runtime_dirs != '' , 'visual_studio_path requires visual_studio_runtime_dirs' assert windows_sdk_path != '' , 'visual_studio_path requires windows_sdk_path' assert os . environ . get ( 'DEPOT_TOOLS_WIN_TOOLCHAIN' , '' ) == '0' , "visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable" msvs_path = os . environ . get ( 'GYP_MSVS_OVERRIDE_PATH' , '' ) assert msvs_path == visual_studio_path and os . path . exists ( msvs_path ) , "visual_studio_path requires matching GYP_MSVS_OVERRIDE_PATH env variable" msvs_version = os . environ . get ( 'GYP_MSVS_VERSION' , '' ) assert msvs_version == visual_studio_version , "visual_studio_version requires matching GYP_MSVS_VERSION env variable" assert os . environ . get ( 'CEF_VCVARS' , '' ) == 'none' , "visual_studio_path requires CEF_VCVARS=none env variable" assert 'INCLUDE' in os . environ and 'LIB' in os . environ and 'PATH' in os . environ , "visual_studio_path requires INCLUDE, LIB and PATH env variables" # If "%GYP_MSVS_OVERRIDE_PATH%\VC\vcvarsall.bat" exists then environment # variables will be derived from there and the specified INCLUDE/LIB/PATH # values will be ignored by Chromium. If this file does not exist then the # INCLUDE/LIB/PATH values are also required by Chromium. vcvars_path = os . path . join ( msvs_path , 'VC' , 'vcvarsall.bat' ) if ( os . path . exists ( vcvars_path ) ) : msg ( 'INCLUDE/LIB/PATH values will be derived from %s' % vcvars_path )