Skip to content

Commit f19c776

Browse files
committed
feat: add a separate vcvarsall
1 parent 902069d commit f19c776

File tree

8 files changed

+29
-15
lines changed

8 files changed

+29
-15
lines changed

LICENSE.dependencies.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ setup-cpp reused some code from the following projects:
44
- [install-cmake](https://github.com/Symbitic/install-cmake/blob/master/LICENSE.md): MIT
55
- [get-cmake](https://github.com/lukka/get-cmake/blob/main/LICENSE.txt): MIT
66
- [gha-setup-ninja](https://github.com/seanmiddleditch/gha-setup-ninja): MIT
7-
- [setup-python](https://github.com/actions/setup-python): MIT
87

98
This package also uses the depedencies listed in package.json. You can get the list of their licenses using the following command:
109
```
1110
npm install -g license-checker
12-
license-checker --summary --production
11+
license-checker --summary --production --excludePackages "setup-python@2.2.2"
1312
```
1413

1514
```
16-
├─ MIT: 8
15+
├─ MIT: 9
1716
├─ ISC: 2
1817
└─ Apache-2.0: 1
19-
```
18+
```
19+
20+
setup-python@2.2.2 is MIT license.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
1919
- gcc
2020
- cmake
2121
- ninja
22+
- vcvarsall
2223
- vcpkg
2324
- meson
2425
- conan

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ inputs:
1818
msvc:
1919
description: "The msvc version to install"
2020
required: false
21+
vcvarsall:
22+
description: "If should run vcvarsall?"
23+
required: false
2124
cmake:
2225
description: "The cmake version to install."
2326
required: false

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
"execa": "^5.1.1",
3737
"hasha": "^5.2.2",
3838
"mri": "^1.2.0",
39+
"msvc-dev-cmd": " https://github.com/ilammy/msvc-dev-cmd",
3940
"semver": "^7.3.5",
40-
"untildify": "^4.0.0",
41-
"which": "^2.0.2",
4241
"setup-python": "https://github.com/actions/setup-python",
43-
"msvc-dev-cmd": " https://github.com/ilammy/msvc-dev-cmd"
42+
"untildify": "^4.0.0",
43+
"which": "^2.0.2"
4444
},
4545
"devDependencies": {
4646
"@types/cross-spawn": "^6.0.2",

src/main.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { error, success } from "./utils/io/io"
2626
import { setupVcpkg } from "./vcpkg/vcpkg"
2727
import { join } from "path"
2828
import { warning } from "@actions/core"
29+
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
2930

3031
/** The setup functions */
3132
const setups = {
@@ -45,6 +46,7 @@ const setups = {
4546
doxygen: setupDoxygen,
4647
cppcheck: setupCppcheck,
4748
msvc: setupMSVC,
49+
vcvarsall: setupVCVarsall,
4850
}
4951

5052
/** The tools that can be installed */
@@ -65,6 +67,7 @@ const tools: Array<keyof typeof setups> = [
6567
"llvm",
6668
"gcc",
6769
"msvc",
70+
"vcvarsall",
6871
]
6972

7073
/** The possible inputs to the program */
@@ -116,9 +119,15 @@ export async function main(args: string[]): Promise<number> {
116119

117120
// running the setup function for this tool
118121
try {
119-
// eslint-disable-next-line no-await-in-loop
120-
const installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
121-
122+
let installationInfo: InstallationInfo | undefined | void
123+
if (tool === "vcvarsall") {
124+
// TODO expose the options
125+
// eslint-disable-next-line no-await-in-loop
126+
;(setupFunction as typeof setupVCVarsall)(undefined, arch, undefined, undefined, false, false)
127+
} else {
128+
// eslint-disable-next-line no-await-in-loop
129+
installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
130+
}
122131
// preparing a report string
123132
if (installationInfo !== undefined) {
124133
successMessages.push(getSuccessMessage(tool, installationInfo))
@@ -252,6 +261,7 @@ Install all the tools required for building and testing C++/C projects.
252261
All the available tools:
253262
--llvm
254263
--gcc
264+
--vcvarsall
255265
--cmake
256266
--ninja
257267
--vcpkg

src/msvc/msvc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
22
import { error, exportVariable, warning } from "@actions/core"
33
import { existsSync } from "fs"
44
import { isCI } from "../utils/env/isci"
5-
import { activateMSVC } from "../vcvarsall/vcvarsall"
5+
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
66

77
type MSVCVersion = "2015" | "2017" | "2019" | string
88

@@ -56,5 +56,5 @@ export async function setupMSVC(
5656
}
5757
}
5858
// run vcvarsall.bat environment variables
59-
activateMSVC(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
59+
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
6060
}

src/vcvarsall/vcvarsall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function getArch(arch: string): string {
1717
}
1818
}
1919

20-
export function activateMSVC(
20+
export function setupVCVarsall(
2121
VCTargetsPath: string | undefined,
2222
arch: string,
2323
toolset: string | undefined,

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@
2727
"outDir": "./dist"
2828
},
2929
"compileOnSave": false,
30-
"include": ["./src"],
31-
"exclude": ["./src/python/setup-python", "src/msvc-dev-cmd/msvc-dev-cmd"]
30+
"include": ["./src"]
3231
}

0 commit comments

Comments
 (0)