-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build,win: use latest installed VS by default and respect VS version for building addons #13911
build,win: use latest installed VS by default and respect VS version for building addons #13911
Conversation
vcbuild.bat should detect what version of Visual Studio to use, it should simply work without any parameter if any supported version is installed. It should default to the latest version, to match the behavior of `node-gyp`. Fixes: nodejs#13641
When building in machines with multiple versions of Visual Studio installed, node-gyp should respect the vs2015/vs2017 arguments passed to vcbuild.bat instead of relying on its own detection mechanism.
@@ -201,6 +203,8 @@ if defined msi ( | |||
call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" | |||
SET VCVARS_VER=140 | |||
if not defined VCINSTALLDIR goto msbuild-not-found | |||
@rem Visual C++ Build Tools 2015 does not define VisualStudioVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? I test with "Build Tools 2015" and I get VisualStudioVersion
? But anyway next line is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Visual C++ Build Tools 2015" != "Build Tools 2015"... I'm sure VCBT doesn't set this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ment "Visual C++ Build Tools 2015", but I might have installed "VS 2015 community" on the machine I'm thinking of... Too many configuration 😵
@@ -122,6 +122,9 @@ if defined build_release ( | |||
|
|||
:: assign path to node_exe | |||
set "node_exe=%config%\node.exe" | |||
set "node_gyp_exe="%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp" | |||
if "%target_env%"=="vs2015" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2015" | |||
if "%target_env%"=="vs2017" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2017" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work? the GYP
in node-gyp
still doesn't know 2017 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works. node-gyp
still uses the workaround to configure 2017 as 2015, but this line should be correct for the future. Right now it triggers this: https://github.com/nodejs/node-gyp/blob/c84a541/lib/configure.js#L93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joaocgreis Doesn't this only cover the case where "vs2017" or "vs2015" is passed explicitly? Shouldn't we wait until the VS version detection is over before trying to add the argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought, but if vs20XX
was specified explicitly, only that version will be tried, so it's ok to set early.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, I suppose node-gyp will also default to the highest installed version of VS so as long as they both have the same behavior then everything should work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set GYP_MSVS_VERSION, node-gyp
should respect that as well
CI: https://ci.nodejs.org/view/All/job/node-test-pull-request/8823/ |
The yellowness is known. |
@joaocgreis I'll give this a try today and report back. |
@joaocgreis I'm not seeing any issues on my machine. I tried the default case with no arguments as well as explicitly passing vs2015. |
@kfarnung hide |
Also try |
vcbuild.bat should detect what version of Visual Studio to use, it should simply work without any parameter if any supported version is installed. It should default to the latest version, to match the behavior of `node-gyp`. PR-URL: #13911 Fixes: #13641 Reviewed-By: Refael Ackermann <refack@gmail.com>
When building in machines with multiple versions of Visual Studio installed, node-gyp should respect the vs2015/vs2017 arguments passed to vcbuild.bat instead of relying on its own detection mechanism. PR-URL: #13911 Reviewed-By: Refael Ackermann <refack@gmail.com>
Landed in e6b69b9...c9cf7c2 I confirmed that |
@joaocgreis are release builds still done with |
@refack yes, VS2013 is only for v4 now. |
Wanted to make sure |
We don't have release machines with VS2017 yet, and I think it's too early for that. The change will probably be driven by V8. We'll need to transition in a major version. For now, we should build the nightlies with the same compiler, to ensure they are a proper smoke test. |
FWIW I'm keeping an eye on the |
vcbuild.bat should detect what version of Visual Studio to use, it should simply work without any parameter if any supported version is installed. It should default to the latest version, to match the behavior of `node-gyp`. PR-URL: nodejs#13911 Fixes: nodejs#13641 Reviewed-By: Refael Ackermann <refack@gmail.com>
When building in machines with multiple versions of Visual Studio installed, node-gyp should respect the vs2015/vs2017 arguments passed to vcbuild.bat instead of relying on its own detection mechanism. PR-URL: nodejs#13911 Reviewed-By: Refael Ackermann <refack@gmail.com>
vcbuild.bat should detect what version of Visual Studio to use, it should simply work without any parameter if any supported version is installed. It should default to the latest version, to match the behavior of `node-gyp`. PR-URL: #13911 Fixes: #13641 Reviewed-By: Refael Ackermann <refack@gmail.com>
When building in machines with multiple versions of Visual Studio installed, node-gyp should respect the vs2015/vs2017 arguments passed to vcbuild.bat instead of relying on its own detection mechanism. PR-URL: #13911 Reviewed-By: Refael Ackermann <refack@gmail.com>
vcbuild.bat should detect what version of Visual Studio to use, it should simply work without any parameter if any supported version is installed. It should default to the latest version, to match the behavior of `node-gyp`. PR-URL: #13911 Fixes: #13641 Reviewed-By: Refael Ackermann <refack@gmail.com>
When building in machines with multiple versions of Visual Studio installed, node-gyp should respect the vs2015/vs2017 arguments passed to vcbuild.bat instead of relying on its own detection mechanism. PR-URL: #13911 Reviewed-By: Refael Ackermann <refack@gmail.com>
Should this be backported to |
Question: can PlatformToolkit |
@saper, currently the released binaries (v6.x, v8.x, and the v9.x nightlies) are explicitly built with VS2015. We do need to test compatibility between a |
vcbuild.bat
should detect what version of Visual Studio to use, it should simply work without any parameter if any supported version is installed. It should default to the latest version, to match the behavior ofnode-gyp
.The second commit makes
node-gyp
use the same Visual Studio version if it is explicitly specified with avs2015/vs2017
parameter. If no parameter is specified, the detection mechanism built intonode-gyp
should be used, so that we can still test addons with VS2013 (which is still supported).Fixes: #13641
I tested this locally on a VM with VS2015 and VS2017 installed. Also tested with an unusable installation of VS2017. @kfarnung can you also try this if you have a machine with both versions at hand?
cc @nodejs/platform-windows
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
Build, Windows.