Skip to content

Commit

Permalink
win: use msbuild from the configure stage
Browse files Browse the repository at this point in the history
If node-gyp configure has set up MSBuild location use it instead the
one that happens to be first on the PATH.

PR-URL: #1654
Fixes: #1653
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
  • Loading branch information
bzoz authored and refack committed Feb 13, 2019
1 parent 83f8749 commit bb8b294
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ function build (gyp, argv, callback) {
*/

function doWhich () {
// On Windows use msbuild provided by node-gyp configure
if (win && config.variables.msbuild_path) {
command = config.variables.msbuild_path
log.verbose('using MSBuild:', command)
doBuild()
return
}
// First make sure we have the build command in the PATH
which(command, function (err, execPath) {
if (err) {
Expand All @@ -117,13 +124,6 @@ function build (gyp, argv, callback) {
*/

function findMsbuild () {
if (config.variables.msbuild_path) {
command = config.variables.msbuild_path
log.verbose('using MSBuild:', command)
doBuild()
return
}

log.verbose('could not find "msbuild.exe" in PATH - finding location in registry')
var notfoundErr = 'Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?'
var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
Expand Down

0 comments on commit bb8b294

Please sign in to comment.