Skip to content
This repository has been archived by the owner on Aug 19, 2019. It is now read-only.

Commit

Permalink
Add Linux MSBuild detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Rowan Potgieter committed Jun 13, 2017
1 parent a549abc commit 183a7ec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/msbuild-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ var detectMsBuild15Dir = function(pathRoot) {
}
}

// Use MSBuild over XBuild where possible
var detectLinuxMsBuildExecutable = function() {
var msbuildExecutable = 'msbuild';
var possibleFolders = ['/usr/bin/'];

for(var index = 0; index < possibleFolders.length; index++) {
try {
var filePath = path.join(possibleFolders[index], msbuildExecutable);
fs.statSync(filePath);
return filePath;
} catch (e) { }
}
}

var autoDetectVersion = function(pathRoot) {
// Try to detect MSBuild 15.0.
var msbuild15Dir = detectMsBuild15Dir(pathRoot);
Expand Down Expand Up @@ -62,6 +76,10 @@ var autoDetectVersion = function(pathRoot) {

module.exports.find = function (options) {
if (!options.platform.match(/^win/)) {
var msbuildPath = detectLinuxMsBuildExecutable();
if (msbuildPath) {
return msbuildPath;
}
return 'xbuild';
}

Expand Down

0 comments on commit 183a7ec

Please sign in to comment.