Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit a58b174

Browse files
committed
build,win: set env before generating projects
vcbuild.bat calls python configure before setting GYP_MSVS_VERSION, so SelectVisualStudioVersion (tools\gyp\pylib\gyp\MSVSVersion.py) defaults to 'auto' and selects VS 2005. vcbuild sets the environment in the current shell, so this issue would manifest itself only on the first invocation of the script in any given shell windows. Reviewed-By: Julien Gilli <[email protected]> PR-URL: #20109
1 parent f99eaef commit a58b174

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

vcbuild.bat

+19-18
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,9 @@ if "%i18n_arg%"=="full-icu" set i18n_arg=--with-intl=full-icu
102102
if "%i18n_arg%"=="small-icu" set i18n_arg=--with-intl=small-icu
103103
if "%i18n_arg%"=="intl-none" set i18n_arg=--with-intl=none
104104

105-
:project-gen
106-
@rem Skip project generation if requested.
107-
if defined noprojgen goto msbuild
108-
109105
if defined NIGHTLY set TAG=nightly-%NIGHTLY%
110106

111-
@rem Generate the VS project.
112-
SETLOCAL
113-
if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat"
114-
python configure %download_arg% %i18n_arg% %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
115-
if errorlevel 1 goto create-msvs-files-failed
116-
if not exist node.sln goto create-msvs-files-failed
117-
echo Project files generated.
118-
ENDLOCAL
119-
120-
:msbuild
121-
@rem Skip project generation if requested.
122-
if defined nobuild goto sign
107+
@rem Set environment for msbuild
123108

124109
@rem Look for Visual Studio 2013
125110
if not defined VS120COMNTOOLS goto vc-set-2012
@@ -152,13 +137,29 @@ if "%VCVARS_VER%" NEQ "100" (
152137
SET VCVARS_VER=100
153138
)
154139
if not defined VCINSTALLDIR goto msbuild-not-found
140+
set GYP_MSVS_VERSION=2010
155141
goto msbuild-found
156142

157143
:msbuild-not-found
158-
echo Build skipped. To build, this file needs to run from VS cmd prompt.
159-
goto run
144+
echo Failed to find Visual Studio installation.
145+
goto exit
160146

161147
:msbuild-found
148+
149+
:project-gen
150+
@rem Skip project generation if requested.
151+
if defined noprojgen goto msbuild
152+
153+
@rem Generate the VS project.
154+
python configure %download_arg% %i18n_arg% %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
155+
if errorlevel 1 goto create-msvs-files-failed
156+
if not exist node.sln goto create-msvs-files-failed
157+
echo Project files generated.
158+
159+
:msbuild
160+
@rem Skip project generation if requested.
161+
if defined nobuild goto sign
162+
162163
@rem Build the sln with msbuild.
163164
msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
164165
if errorlevel 1 goto exit

0 commit comments

Comments
 (0)