feat: add a separate vcvarsall

This commit is contained in:
Amin Yahyaabadi 2021-12-05 08:20:14 -06:00
parent 902069de32
commit f19c776f46
8 changed files with 29 additions and 15 deletions

View File

@ -4,16 +4,17 @@ setup-cpp reused some code from the following projects:
- [install-cmake](https://github.com/Symbitic/install-cmake/blob/master/LICENSE.md): MIT
- [get-cmake](https://github.com/lukka/get-cmake/blob/main/LICENSE.txt): MIT
- [gha-setup-ninja](https://github.com/seanmiddleditch/gha-setup-ninja): MIT
- [setup-python](https://github.com/actions/setup-python): MIT
This package also uses the depedencies listed in package.json. You can get the list of their licenses using the following command:
```
npm install -g license-checker
license-checker --summary --production
license-checker --summary --production --excludePackages "setup-python@2.2.2"
```
```
├─ MIT: 8
├─ MIT: 9
├─ ISC: 2
└─ Apache-2.0: 1
```
```
setup-python@2.2.2 is MIT license.

View File

@ -19,6 +19,7 @@ The package can be used locally or from CI services like GitHub Actions. Stay tu
- gcc
- cmake
- ninja
- vcvarsall
- vcpkg
- meson
- conan

View File

@ -18,6 +18,9 @@ inputs:
msvc:
description: "The msvc version to install"
required: false
vcvarsall:
description: "If should run vcvarsall?"
required: false
cmake:
description: "The cmake version to install."
required: false

View File

@ -36,11 +36,11 @@
"execa": "^5.1.1",
"hasha": "^5.2.2",
"mri": "^1.2.0",
"msvc-dev-cmd": " https://github.com/ilammy/msvc-dev-cmd",
"semver": "^7.3.5",
"untildify": "^4.0.0",
"which": "^2.0.2",
"setup-python": "https://github.com/actions/setup-python",
"msvc-dev-cmd": " https://github.com/ilammy/msvc-dev-cmd"
"untildify": "^4.0.0",
"which": "^2.0.2"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.2",

View File

@ -26,6 +26,7 @@ import { error, success } from "./utils/io/io"
import { setupVcpkg } from "./vcpkg/vcpkg"
import { join } from "path"
import { warning } from "@actions/core"
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
/** The setup functions */
const setups = {
@ -45,6 +46,7 @@ const setups = {
doxygen: setupDoxygen,
cppcheck: setupCppcheck,
msvc: setupMSVC,
vcvarsall: setupVCVarsall,
}
/** The tools that can be installed */
@ -65,6 +67,7 @@ const tools: Array<keyof typeof setups> = [
"llvm",
"gcc",
"msvc",
"vcvarsall",
]
/** The possible inputs to the program */
@ -116,9 +119,15 @@ export async function main(args: string[]): Promise<number> {
// running the setup function for this tool
try {
// eslint-disable-next-line no-await-in-loop
const installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
let installationInfo: InstallationInfo | undefined | void
if (tool === "vcvarsall") {
// TODO expose the options
// eslint-disable-next-line no-await-in-loop
;(setupFunction as typeof setupVCVarsall)(undefined, arch, undefined, undefined, false, false)
} else {
// eslint-disable-next-line no-await-in-loop
installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
}
// preparing a report string
if (installationInfo !== undefined) {
successMessages.push(getSuccessMessage(tool, installationInfo))
@ -252,6 +261,7 @@ Install all the tools required for building and testing C++/C projects.
All the available tools:
--llvm
--gcc
--vcvarsall
--cmake
--ninja
--vcpkg

View File

@ -2,7 +2,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { error, exportVariable, warning } from "@actions/core"
import { existsSync } from "fs"
import { isCI } from "../utils/env/isci"
import { activateMSVC } from "../vcvarsall/vcvarsall"
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
type MSVCVersion = "2015" | "2017" | "2019" | string
@ -56,5 +56,5 @@ export async function setupMSVC(
}
}
// run vcvarsall.bat environment variables
activateMSVC(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
setupVCVarsall(VCTargetsPath, arch, toolset, sdk, uwp, spectre)
}

View File

@ -17,7 +17,7 @@ function getArch(arch: string): string {
}
}
export function activateMSVC(
export function setupVCVarsall(
VCTargetsPath: string | undefined,
arch: string,
toolset: string | undefined,

View File

@ -27,6 +27,5 @@
"outDir": "./dist"
},
"compileOnSave": false,
"include": ["./src"],
"exclude": ["./src/python/setup-python", "src/msvc-dev-cmd/msvc-dev-cmd"]
"include": ["./src"]
}