Skip to content

Commit

Permalink
msvc-dev-cmd v1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ilammy committed Oct 3, 2020
2 parents b44b596 + 840499b commit ed94116
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 61 deletions.
27 changes: 13 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,43 @@ const InterestingVariables = [
]

function findWithVswhere(pattern) {
let path = null;
try {
path = child_process.execSync(`vswhere -products * -latest -prerelease -find ${pattern}`).toString().trim()
let installationPath = child_process.execSync(`vswhere -products * -latest -prerelease -property installationPath`).toString().trim()
return installationPath + '\\' + pattern
} catch (e) {
console.log(e)
core.warn(`vswhere failed: ${e}`)
}
return path
return null
}

function findVcvarsall() {
// use vswhere
let path = findWithVswhere('**/Auxiliary/Build/vcvarsall.bat')
// If vswhere is available, ask it about the location of the latest Visual Studio.
let path = findWithVswhere('VC\\Auxiliary\\Build\\vcvarsall.bat')
if (path && fs.existsSync(path)) {
core.debug(`found with vswhere: ${path}`)
return path
}

// If that does not work, try the standard installation locations,
// starting with the latest and moving to the oldest.
const programFiles = process.env['ProgramFiles(x86)']
// Given the order of each list it should check
// for the more recent versions first and the
// highest grade edition first.
for (const ver of VERSIONS) {
for (const ed of EDITIONS) {
path = `${programFiles}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
if (fs.existsSync(path)) {
core.debug(`found standard location: ${path}`)
return path
}
}
}

// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
// us vswhere
path = findWithVswhere('**/vcbuildtools.bat')
if (path && fs.existsSync(path)) {
return path
}
path = `${programFiles}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`
if (fs.existsSync(path)) {
core.debug(`found VS 2015: ${path}`)
return path
}

throw new Error('Microsoft Visual Studio not found')
}

Expand Down
9 changes: 9 additions & 0 deletions node_modules/@actions/core/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 3 additions & 16 deletions node_modules/@actions/core/lib/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/command.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions node_modules/@actions/core/lib/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/core.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/@actions/core/lib/file-command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions node_modules/@actions/core/lib/file-command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/@actions/core/lib/file-command.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions node_modules/@actions/core/lib/utils.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed94116

Please sign in to comment.