mirror of
https://github.com/ilammy/msvc-dev-cmd.git
synced 2026-09-06 21:57:19 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b44b596ee5 | |||
| 4b3ec49c71 | |||
| 8a8bb270fb |
@@ -1,5 +1,6 @@
|
|||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const exec = require('util').promisify(require('child_process').exec)
|
const child_process = require('child_process')
|
||||||
|
const exec = require('util').promisify(child_process.exec)
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const process = require('process')
|
const process = require('process')
|
||||||
|
|
||||||
@@ -18,21 +19,42 @@ const InterestingVariables = [
|
|||||||
/^WindowsSDK/i,
|
/^WindowsSDK/i,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
function findWithVswhere(pattern) {
|
||||||
|
let path = null;
|
||||||
|
try {
|
||||||
|
path = child_process.execSync(`vswhere -products * -latest -prerelease -find ${pattern}`).toString().trim()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
function findVcvarsall() {
|
function findVcvarsall() {
|
||||||
|
// use vswhere
|
||||||
|
let path = findWithVswhere('**/Auxiliary/Build/vcvarsall.bat')
|
||||||
|
if (path && fs.existsSync(path)) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
const programFiles = process.env['ProgramFiles(x86)']
|
const programFiles = process.env['ProgramFiles(x86)']
|
||||||
// Given the order of each list it should check
|
// Given the order of each list it should check
|
||||||
// for the more recent versions first and the
|
// for the more recent versions first and the
|
||||||
// highest grade edition first.
|
// highest grade edition first.
|
||||||
for (const ver of VERSIONS) {
|
for (const ver of VERSIONS) {
|
||||||
for (const ed of EDITIONS) {
|
for (const ed of EDITIONS) {
|
||||||
const path = `${programFiles}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
|
path = `${programFiles}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||||
const path = `${programFiles}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`
|
// 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)) {
|
if (fs.existsSync(path)) {
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+3
-3
@@ -678,9 +678,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.15",
|
"version": "4.17.19",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
|
||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
"integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mimic-fn": {
|
"mimic-fn": {
|
||||||
|
|||||||
Reference in New Issue
Block a user