mirror of https://github.com/aminya/setup-cpp
fix: catch msvc installation bugs
This commit is contained in:
parent
4285e7bb04
commit
5e6cf5d519
|
@ -1,6 +1,6 @@
|
||||||
import { setupMSVCDevCmd } from "./msvc-dev-cmd/index"
|
import { setupMSVCDevCmd } from "./msvc-dev-cmd/index"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { exportVariable } from "@actions/core"
|
import { error, exportVariable } from "@actions/core"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
|
|
||||||
type MSVCVersion = "2015" | "2017" | "2019" | string
|
type MSVCVersion = "2015" | "2017" | "2019" | string
|
||||||
|
@ -34,9 +34,14 @@ export async function setupMSVC(
|
||||||
}
|
}
|
||||||
let toolset: string | undefined
|
let toolset: string | undefined
|
||||||
let VCTargetsPath: string | undefined
|
let VCTargetsPath: string | undefined
|
||||||
|
try {
|
||||||
if (version === "2015") {
|
if (version === "2015") {
|
||||||
toolset = "14.0.25420.1"
|
toolset = "14.0.25420.1"
|
||||||
await setupChocoPack("visualcpp-build-tools", toolset, ["--ignore-dependencies", "--params", "'/IncludeRequired'"])
|
await setupChocoPack("visualcpp-build-tools", toolset, [
|
||||||
|
"--ignore-dependencies",
|
||||||
|
"--params",
|
||||||
|
"'/IncludeRequired'",
|
||||||
|
])
|
||||||
|
|
||||||
VCTargetsPath = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"
|
VCTargetsPath = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"
|
||||||
if (existsSync(VCTargetsPath)) {
|
if (existsSync(VCTargetsPath)) {
|
||||||
|
@ -57,6 +62,9 @@ export async function setupMSVC(
|
||||||
])
|
])
|
||||||
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
|
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
error(e as string | Error)
|
||||||
|
}
|
||||||
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
|
if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) {
|
||||||
exportVariable("VCTargetsPath", VCTargetsPath)
|
exportVariable("VCTargetsPath", VCTargetsPath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue