Skip to content

Commit 1d04cc2

Browse files
committed
fix: update the msvc packages and disable variables
1 parent f19c776 commit 1d04cc2

File tree

4 files changed

+32
-40
lines changed

4 files changed

+32
-40
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,3 @@ After build, run the following to start an interactive shell in your container
183183
```ps1
184184
docker run -it setup_cpp
185185
```
186-
187-
### Incomplete
188-
189-
- `msvc`. It is implemented, but it has bugs. See [this issue](https://github.com/aminya/setup-cpp/issues/1)

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/msvc/msvc.ts

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { setupChocoPack } from "../utils/setup/setupChocoPack"
2-
import { error, exportVariable, warning } from "@actions/core"
2+
import { error, exportVariable } from "@actions/core"
33
import { existsSync } from "fs"
4-
import { isCI } from "../utils/env/isci"
54
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
65

76
type MSVCVersion = "2015" | "2017" | "2019" | string
@@ -19,41 +18,38 @@ export async function setupMSVC(
1918
}
2019
let toolset: string | undefined
2120
let VCTargetsPath: string | undefined
22-
if (!isCI()) {
23-
// TODO enable this code path once its bugs are fixed
24-
// https://github.com/aminya/setup-cpp/issues/1
25-
warning("Installing MSVC is experimental and known to fail.")
26-
try {
27-
if (version === "2015") {
28-
toolset = "14.0.25420.1"
29-
await setupChocoPack("visualcpp-build-tools", toolset, [
30-
"--ignore-dependencies",
31-
"--params",
32-
"'/IncludeRequired'",
33-
])
21+
// TODO enable this code path once its bugs are fixed
22+
// https://github.com/aminya/setup-cpp/issues/1
23+
try {
24+
if (version === "2015") {
25+
// toolset = "14.0.25420.1"
26+
await setupChocoPack("visualcpp-build-tools", toolset, [
27+
"--ignore-dependencies",
28+
"--params",
29+
"'/IncludeRequired'",
30+
])
3431

35-
VCTargetsPath = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"
36-
if (existsSync(VCTargetsPath)) {
37-
exportVariable("VCTargetsPath", VCTargetsPath)
38-
}
39-
} else if (version === "2017") {
40-
toolset = "14.16"
41-
await setupChocoPack("visualstudio2017buildtools", "15.9.38.0", [
42-
"--package-parameters",
43-
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
44-
])
45-
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16" // TODO verify path
46-
} else if (version === "2019") {
47-
toolset = "14.29.30133"
48-
await setupChocoPack("visualstudio2019buildtools", "16.11.2.0", [
49-
"--package-parameters",
50-
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
51-
])
52-
VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
32+
VCTargetsPath = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"
33+
if (existsSync(VCTargetsPath)) {
34+
exportVariable("VCTargetsPath", VCTargetsPath)
5335
}
54-
} catch (e) {
55-
error(e as string | Error)
36+
} else if (version === "2017") {
37+
// toolset = "14.16"
38+
await setupChocoPack("visualstudio2017buildtools", "15.9.41.0", [
39+
"--package-parameters",
40+
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
41+
])
42+
// VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16" // TODO verify path
43+
} else if (version === "2019") {
44+
// toolset = "14.29.30133"
45+
await setupChocoPack("visualstudio2019buildtools", "16.11.7.0", [
46+
"--package-parameters",
47+
"'--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive'",
48+
])
49+
// VCTargetsPath = "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"
5650
}
51+
} catch (e) {
52+
error(e as string | Error)
5753
}
5854
// run vcvarsall.bat environment variables
5955
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)

0 commit comments

Comments
 (0)