1
1
import { setupChocoPack } from "../utils/setup/setupChocoPack"
2
- import { error , exportVariable , warning } from "@actions/core"
2
+ import { error , exportVariable } from "@actions/core"
3
3
import { existsSync } from "fs"
4
- import { isCI } from "../utils/env/isci"
5
4
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
6
5
7
6
type MSVCVersion = "2015" | "2017" | "2019" | string
@@ -19,41 +18,38 @@ export async function setupMSVC(
19
18
}
20
19
let toolset : string | undefined
21
20
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
+ ] )
34
31
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 )
53
35
}
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"
56
50
}
51
+ } catch ( e ) {
52
+ error ( e as string | Error )
57
53
}
58
54
// run vcvarsall.bat environment variables
59
55
setupVCVarsall ( VCTargetsPath , arch , toolset , sdk , uwp , spectre )
0 commit comments