0

Remove support for GYP_MSVS_VERSION env variable

We support changing Visual Studio versions with the `--ide=vs2017`
flag to `gn gen`. The default version is now VS2019.

Bug: 1038364
Change-Id: I4de7849aab72bfdf1a4ba7465858816500abf122
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984705
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729856}
This commit is contained in:
Aaron Gable
2020-01-09 19:38:52 +00:00
committed by Commit Bot
parent 77eb7e8aaa
commit dad9e0f52b
4 changed files with 7 additions and 20 deletions

@ -69,7 +69,7 @@ def _ExtractImportantEnvironment(output_of_set):
def _DetectVisualStudioPath(): def _DetectVisualStudioPath():
"""Return path to the GYP_MSVS_VERSION of Visual Studio. """Return path to the installed Visual Studio.
""" """
# Use the code in build/vs_toolchain.py to avoid duplicating code. # Use the code in build/vs_toolchain.py to avoid duplicating code.

@ -82,7 +82,6 @@ def SetEnvironmentAndGetRuntimeDllDirs():
vs_runtime_dll_dirs.append('Arm64Unused') vs_runtime_dll_dirs.append('Arm64Unused')
os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
os.environ['GYP_MSVS_VERSION'] = version
os.environ['WINDOWSSDKDIR'] = win_sdk os.environ['WINDOWSSDKDIR'] = win_sdk
os.environ['WDK_DIR'] = wdk os.environ['WDK_DIR'] = wdk
@ -92,8 +91,6 @@ def SetEnvironmentAndGetRuntimeDllDirs():
elif sys.platform == 'win32' and not depot_tools_win_toolchain: elif sys.platform == 'win32' and not depot_tools_win_toolchain:
if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ: if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ:
os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath() os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath()
if not 'GYP_MSVS_VERSION' in os.environ:
os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
# When using an installed toolchain these files aren't needed in the output # When using an installed toolchain these files aren't needed in the output
# directory in order to run binaries locally, but they are needed in order # directory in order to run binaries locally, but they are needed in order
@ -143,11 +140,6 @@ def _RegistryGetValue(key, value):
def GetVisualStudioVersion(): def GetVisualStudioVersion():
"""Return best available version of Visual Studio. """Return best available version of Visual Studio.
""" """
env_version = os.environ.get('GYP_MSVS_VERSION')
if env_version:
return env_version
supported_versions = MSVS_VERSIONS.keys() supported_versions = MSVS_VERSIONS.keys()
# VS installed in depot_tools for Googlers # VS installed in depot_tools for Googlers
@ -175,7 +167,7 @@ def GetVisualStudioVersion():
def DetectVisualStudioPath(): def DetectVisualStudioPath():
"""Return path to the GYP_MSVS_VERSION of Visual Studio. """Return path to the installed Visual Studio.
""" """
# Note that this code is used from # Note that this code is used from
@ -203,8 +195,7 @@ def DetectVisualStudioPath():
if path and os.path.exists(path): if path and os.path.exists(path):
return path return path
raise Exception('Visual Studio Version %s (from GYP_MSVS_VERSION)' raise Exception('Visual Studio Version %s not found.' % version_as_year)
' not found.' % version_as_year)
def _CopyRuntimeImpl(target, source, verbose=True): def _CopyRuntimeImpl(target, source, verbose=True):
@ -500,9 +491,6 @@ def Update(force=False, no_download=False):
subprocess.check_call([ subprocess.check_call([
ciopfs, '-o', 'use_ino', toolchain_dir + '.ciopfs', toolchain_dir]) ciopfs, '-o', 'use_ino', toolchain_dir + '.ciopfs', toolchain_dir])
# Necessary so that get_toolchain_if_necessary.py will put the VS toolkit
# in the correct directory.
os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion()
get_toolchain_args = [ get_toolchain_args = [
sys.executable, sys.executable,
os.path.join(depot_tools_path, os.path.join(depot_tools_path,

@ -88,9 +88,7 @@ if your system PATH has a Python in it, you will be out of luck.
Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set
it to 0. This tells depot_tools to use your locally installed version of Visual it to 0. This tells depot_tools to use your locally installed version of Visual
Studio (by default, depot_tools will try to use a google-internal version). If Studio (by default, depot_tools will try to use a google-internal version).
you want to build with Visual Studio 2017 instead of Visual Studio 2019 (the
default) then set the GYP_MSVS_VERSION environment variable to 2017.
From a cmd.exe shell, run the command gclient (without arguments). On first From a cmd.exe shell, run the command gclient (without arguments). On first
run, gclient will install all the Windows-specific bits needed to work with run, gclient will install all the Windows-specific bits needed to work with
@ -168,7 +166,8 @@ $ gn gen out/Default
update the build files as needed. update the build files as needed.
* You can replace `Default` with another name, but * You can replace `Default` with another name, but
it should be a subdirectory of `out`. it should be a subdirectory of `out`.
* For other build arguments, including release settings, see [GN build * For other build arguments, including release settings or using an alternate
version of Visual Studio, see [GN build
configuration](https://www.chromium.org/developers/gn-build-configuration). configuration](https://www.chromium.org/developers/gn-build-configuration).
The default will be a debug component build matching the current host The default will be a debug component build matching the current host
operating system and CPU. operating system and CPU.

@ -5,7 +5,7 @@ REM Use of this source code is governed by a BSD-style license that can be
REM found in the LICENSE file. REM found in the LICENSE file.
REM Run this script to add the current toolchain, as determined by REM Run this script to add the current toolchain, as determined by
REM GYP_MSVS_VERSION, DEPOT_TOOLS_WIN_TOOLCHAIN and the hash in vs_toolchain.py, REM DEPOT_TOOLS_WIN_TOOLCHAIN and the hash in vs_toolchain.py,
REM to the path. Be aware of running this multiple times as too-long paths will REM to the path. Be aware of running this multiple times as too-long paths will
REM break things. REM break things.
REM To get the toolchain for x64 targets pass /x64 to this batch file. REM To get the toolchain for x64 targets pass /x64 to this batch file.