Skip to content

Commit

Permalink
fix: update the msvc packages and disable variables
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 5, 2021
1 parent cb6c11a commit d066cfb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

63 changes: 30 additions & 33 deletions src/msvc/msvc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { error, exportVariable, warning } from "@actions/core"
import { existsSync } from "fs"
import { isCI } from "../utils/env/isci"
import { setupVCVarsall } from "../vcvarsall/vcvarsall"

type MSVCVersion = "2015" | "2017" | "2019" | string
Expand All @@ -19,41 +18,39 @@ export async function setupMSVC(
}
let toolset: string | undefined
let VCTargetsPath: string | undefined
if (!isCI()) {
// TODO enable this code path once its bugs are fixed
// https://github.com/aminya/setup-cpp/issues/1
warning("Installing MSVC is experimental and known to fail.")
try {
if (version === "2015") {
toolset = "14.0.25420.1"
await setupChocoPack("visualcpp-build-tools", toolset, [
"--ignore-dependencies",
"--params",
"'/IncludeRequired'",
])
// TODO enable this code path once its bugs are fixed
// https://github.com/aminya/setup-cpp/issues/1
warning("Installing MSVC is experimental and known to fail.")
try {
if (version === "2015") {
// 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"
if (existsSync(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"
VCTargetsPath = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"
if (existsSync(VCTargetsPath)) {
exportVariable("VCTargetsPath", VCTargetsPath)
}
} catch (e) {
error(e as string | Error)
} else if (version === "2017") {
// toolset = "14.16"
await setupChocoPack("visualstudio2017buildtools", "15.9.41.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.7.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
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
Expand Down

0 comments on commit d066cfb

Please sign in to comment.