Switch to VS 2019.

Goma no longer supports cl.exe and the cl.exe version update in this CL hasn't
been uploaded to goma's servers. Everyone who has bots that use cl.exe must make
sure that these bots don't use goma before rolling this CL in.

This change switches the MSVC toolchain to VS 2019 16.3.29324.

Windows SDK is mostly 10.0.18362
Debuggers from 10.0.17763
d3dcompiler_47.dll from 10.0.17134

The instructions for the previous package are included below:

Packaging was done on a Windows Server 2019 VM, cleanly created for this
purpose.

The package was created by downloading VS 2019 Update 3.29324, from
https://visualstudio.microsoft.com/downloads/ and downloading
the 16.3 Visual Studio Professional 2019, and then running the installer
like this:

$ PATH_TO_INSTALLER.EXE ^
    --add Microsoft.VisualStudio.Workload.NativeDesktop ^
    --add Microsoft.VisualStudio.Component.VC.ATLMFC ^
    --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^
    --add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ^
    --includeRecommended --passive

Then the 10.0.18362.0 SDK was installed from:
https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk.

Then Add or Remove Programs was used to modify the 10.0.18362.0 SDK to add
the Debuggers package.

Then the packaging script was run like this:

  python depot_tools\win_toolchain\package_from_installed.py 2019 -w 10.0.18362.0

Since the new d3dcompiler_47.dll uses the UCRT and we want to avoid shipping
that the final packaging step was to unzip the package, copy over the two copies
of that DLL from win_sdk\Redist, replace the Debuggers directory with the
10.0.17763 SDK, and then repackage the toolchain with:
  > python package_from_installed.py --repackage=<full-path-to-toolchain-dir>

Bug: 1006238
Change-Id: I623632bd72f018a74ab513d2c79e89199915e647
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1836195
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704569}
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index a3a164b..95e32520 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -61,9 +61,12 @@
     "/FS",  # Preserve previous PDB behavior.
     "/bigobj",  # Some of our files are bigger than the regular limits.
     "/utf-8",  # Assume UTF-8 by default to avoid code page dependencies.
-    "/Zc:twoPhase",
   ]
 
+  if (is_clang) {
+    cflags += [ "/Zc:twoPhase" ]
+  }
+
   # Force C/C++ mode for the given GN detected file type. This is necessary
   # for precompiled headers where the same source file is compiled in both
   # modes.
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py
index 3f25061..219f7506 100755
--- a/build/vs_toolchain.py
+++ b/build/vs_toolchain.py
@@ -25,8 +25,8 @@
 
 # VS versions are listed in descending order of priority (highest first).
 MSVS_VERSIONS = collections.OrderedDict([
-  ('2017', '15.0'),
   ('2019', '16.0'),
+  ('2017', '15.0'),
 ])
 
 
@@ -417,17 +417,14 @@
   * //docs/windows_build_instructions.md mentions of VS or Windows SDK.
     Keeps the document consistent with the toolchain version.
   """
-  env_version = GetVisualStudioVersion()
-  if env_version == '2017':
-    # VS 2017 Update 9 (15.9.12) with 10.0.18362 SDK, 10.0.17763 version of
-    # Debuggers, and 10.0.17134 version of d3dcompiler_47.dll, with ARM64
-    # libraries.
-    toolchain_hash = '418b3076791776573a815eb298c8aa590307af63'
-    # Third parties that do not have access to the canonical toolchain can map
-    # canonical toolchain version to their own toolchain versions.
-    toolchain_hash_mapping_key = 'GYP_MSVS_HASH_%s' % toolchain_hash
-    return [os.environ.get(toolchain_hash_mapping_key, toolchain_hash)]
-  raise Exception('Unsupported VS version %s' % env_version)
+  # VS 2019 Update 9 (16.3.29324.140) with 10.0.18362 SDK, 10.0.17763 version of
+  # Debuggers, and 10.0.17134 version of d3dcompiler_47.dll, with ARM64
+  # libraries.
+  toolchain_hash = '8f58c55897a3282ed617055775a77ec3db771b88'
+  # Third parties that do not have access to the canonical toolchain can map
+  # canonical toolchain version to their own toolchain versions.
+  toolchain_hash_mapping_key = 'GYP_MSVS_HASH_%s' % toolchain_hash
+  return [os.environ.get(toolchain_hash_mapping_key, toolchain_hash)]
 
 
 def ShouldUpdateToolchain():