fix: disable msvc installation in CI temporarily

This commit is contained in:
Amin Yahyaabadi 2021-11-23 01:36:57 -06:00
parent 531e651d16
commit 2c56d7e32f
3 changed files with 37 additions and 30 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { error, exportVariable } from "@actions/core" import { error, exportVariable, warning } from "@actions/core"
import { existsSync } from "fs" import { existsSync } from "fs"
import { isCI } from "../utils/env/isci"
type MSVCVersion = "2015" | "2017" | "2019" | string type MSVCVersion = "2015" | "2017" | "2019" | string
@ -33,37 +34,43 @@ export async function setupMSVC(
} }
let toolset: string | undefined let toolset: string | undefined
let VCTargetsPath: string | undefined let VCTargetsPath: string | undefined
try { if (!isCI()) {
if (version === "2015") { // TODO enable this code path once its bugs are fixed
toolset = "14.0.25420.1" // https://github.com/aminya/setup-cpp/issues/1
await setupChocoPack("visualcpp-build-tools", toolset, [ warning("Installing MSVC is experimental and known to fail.")
"--ignore-dependencies", try {
"--params", if (version === "2015") {
"'/IncludeRequired'", toolset = "14.0.25420.1"
]) 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)) {
exportVariable("VCTargetsPath", VCTargetsPath) exportVariable("VCTargetsPath", VCTargetsPath)
}
} else if (version === "2017") {
toolset = "14.16"
await setupChocoPack("visualstudio2017buildtools", "15.9.38.0", [
"--package-parameters",
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
])
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16" // TODO verify path
} else if (version === "2019") {
toolset = "14.29.30133"
await setupChocoPack("visualstudio2019buildtools", "16.11.2.0", [
"--package-parameters",
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
])
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
} }
} else if (version === "2017") { } catch (e) {
toolset = "14.16" error(e as string | Error)
await setupChocoPack("visualstudio2017buildtools", "15.9.38.0", [
"--package-parameters",
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
])
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16" // TODO verify path
} else if (version === "2019") {
toolset = "14.29.30133"
await setupChocoPack("visualstudio2019buildtools", "16.11.2.0", [
"--package-parameters",
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
])
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
} }
} catch (e) {
error(e as string | Error)
} }
// run vcvarsall.bat environment variables
activateMSVC(VCTargetsPath, arch, toolset, sdk, uwp, spectre) activateMSVC(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
} }