fix: update the msvc packages and disable variables

This commit is contained in:
Amin Yahyaabadi 2021-12-05 08:29:01 -06:00
parent f19c776f46
commit 1d04cc2855
4 changed files with 32 additions and 40 deletions

View File

@ -183,7 +183,3 @@ After build, run the following to start an interactive shell in your container
```ps1 ```ps1
docker run -it setup_cpp docker run -it setup_cpp
``` ```
### Incomplete
- `msvc`. It is implemented, but it has bugs. See [this issue](https://github.com/aminya/setup-cpp/issues/1)

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