You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a quick question, but node-gyp is really good at finding the right location of the msbuild.exe to use when compiling. For some very specific compilation stuff we do with libsodium we also need to find it, and have so far been duplication the logic in sodium-native for that.
This made me wonder, is there a CLI command or something equivalent to print the location of msbuild.exe so we can just re-use the great logic already in this tool?
I've moved this issue to gyp-next. @mafintosh, most of the logic you want is inside gyp-next which is a separate repo now and designed to be consumed as a python library. I'm neither a Python, nor a Windows person, and that particular combination of skills is in fairly low supply in the nodejs org, but maybe one of the folks here could point you in the right direction to start sniffing down what you want.
I believe the (better) logic is in node-gyp nowadays, since nodejs/node-gyp#1762. So there are a few options:
Use gyp-next's python code: MSVSVersion.py. Not great because you'd then also have to find the path to python, and this method queries the Windows registry which is less bullet-proof.
Use node-gyp's C# script: Find-VisualStudio.cs. This method uses COM objects, same as used by Microsoft's official vswhere
Or from JS, to run that script with powershell and parse its output: require('node-gyp/lib/find-visualstudio.js')(...).
Bundle vswhere.exe
Run node-gyp configure and then extract variables.msbuild_path from build/config.gypi
Add a command to node-gyp to print those variables.
The last 2 options are the best IMO, because there's no Python, C# or exe to bundle, and it will respect the user's configuration (npm_config_msvs_version and what not).
As the "Python guy" working on the gyp project for the past several years, it would be great if this community could wean itself off of the need for Python. It is easier for this community to code and maintain solutions in JavaScript so please continue migrating in that direction.
Activity
cclauss commentedon Oct 8, 2021
libsodiumissues: https://github.com/nodejs/node-gyp/search?q=libsodium&type=issuesrvagg commentedon Oct 11, 2021
I've moved this issue to gyp-next. @mafintosh, most of the logic you want is inside gyp-next which is a separate repo now and designed to be consumed as a python library. I'm neither a Python, nor a Windows person, and that particular combination of skills is in fairly low supply in the nodejs org, but maybe one of the folks here could point you in the right direction to start sniffing down what you want.
@nodejs/gyp
vweevers commentedon Oct 11, 2021
I believe the (better) logic is in node-gyp nowadays, since nodejs/node-gyp#1762. So there are a few options:
require('node-gyp/lib/find-visualstudio.js')(...).vswhere.exenode-gyp configureand then extractvariables.msbuild_pathfrombuild/config.gypinode-gypto print those variables.The last 2 options are the best IMO, because there's no Python, C# or exe to bundle, and it will respect the user's configuration (
npm_config_msvs_versionand what not).vweevers commentedon Oct 11, 2021
Sample
build/config.gypi:cclauss commentedon Oct 11, 2021
As the "Python guy" working on the gyp project for the past several years, it would be great if this community could wean itself off of the need for Python. It is easier for this community to code and maintain solutions in JavaScript so please continue migrating in that direction.