Fix gn gen after vcvarsall.bat

If you are using a locally installed toolchain
(DEPOT_TOOLS_WIN_TOOLCHAIN=0) then the behavior of gn gen depended on
whether you had run vcvarsall.bat before running gn gen. That is because
vcvarsall.bat appends to several environment variables, these appended
values are captured by, so running vcvarsall.bat
affects the command line of commands generated by gn gen.

This fixes that by clearing INCLUDE, LIB, and LIBPATH so that gn gen is
hermetic. This was tested with VS 2019.

Bug: 1112456
Change-Id: Ib2388466915d26033937004ddc5ca304f81e5d79
Commit-Queue: Dirk Pranke <>
Auto-Submit: Bruce Dawson <>
Reviewed-by: Dirk Pranke <>
Cr-Commit-Position: refs/heads/master@{#794331}
GitOrigin-RevId: 5ac63a961b99bba6cd200e10b82cdadd7f0fbb48
1 file changed