@@ -16,10 +16,27 @@ import { setupPython } from "./python/python"
16
16
17
17
import semverValid from "semver/functions/valid"
18
18
import { getVersion } from "./default_versions"
19
- import { InstallationInfo } from "./utils/setup/setupBin"
20
19
import { setupGcc } from "./gcc/gcc"
21
20
22
- const tools = [
21
+ const setups = {
22
+ cmake : setupCmake ,
23
+ ninja : setupNinja ,
24
+ python : setupPython ,
25
+ conan : setupConan ,
26
+ meson : setupMeson ,
27
+ gcovr : setupGcovr ,
28
+ opencppcoverage : setupOpencppcoverage ,
29
+ llvm : setupLLVM ,
30
+ gcc : setupGcc ,
31
+ choco : setupChocolatey ,
32
+ brew : setupBrew ,
33
+ ccache : setupCcache ,
34
+ doxygen : setupDoxygen ,
35
+ cppcheck : setupCppcheck ,
36
+ msvc : setupMSVC ,
37
+ }
38
+
39
+ const tools : Array < keyof typeof setups > = [
23
40
"cmake" ,
24
41
"ninja" ,
25
42
"python" ,
@@ -37,32 +54,9 @@ const tools = [
37
54
"msvc" ,
38
55
]
39
56
40
- const setups = {
41
- cmake : setupCmake ,
42
- ninja : setupNinja ,
43
- python : setupPython ,
44
- conan : setupConan ,
45
- meson : setupMeson ,
46
- gcovr : setupGcovr ,
47
- opencppcoverage : setupOpencppcoverage ,
48
- llvm : setupLLVM ,
49
- gcc : setupGcc ,
50
- choco : setupChocolatey ,
51
- brew : setupBrew ,
52
- ccache : setupCcache ,
53
- doxygen : setupDoxygen ,
54
- cppcheck : setupCppcheck ,
55
- msvc : setupMSVC ,
56
- } as Record <
57
- string ,
58
- (
59
- version : string | undefined ,
60
- setupCppDir : string ,
61
- ...args : unknown [ ]
62
- ) => Promise < InstallationInfo > | Promise < void > | void
63
- >
57
+ type Inputs = "compiler" | keyof typeof setups
64
58
65
- function maybeGetInput ( key : string ) {
59
+ function maybeGetInput ( key : Inputs ) {
66
60
const value = core . getInput ( key . toLowerCase ( ) )
67
61
if ( value !== "false" && value !== "" ) {
68
62
return value
@@ -131,10 +125,12 @@ export async function main(): Promise<number> {
131
125
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
132
126
if ( installationInfo !== undefined ) {
133
127
let success = `${ tool } was successfully installed`
134
- if ( installationInfo . installDir !== undefined ) {
128
+ if ( "installDir" in installationInfo ) {
129
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
130
+ // @ts -ignore typescript is confused about the existence of installDir
135
131
success += `\nThe installation direcotry is ${ installationInfo . installDir } `
136
132
}
137
- if ( installationInfo . binDir ) {
133
+ if ( installationInfo . binDir !== "" ) {
138
134
success += `\nThe binary direcotry is ${ installationInfo . binDir } `
139
135
}
140
136
toolsSucceeded . push ( success )
0 commit comments