perf: install the compiler after installing the tools

This commit is contained in:
Amin Yahyaabadi 2021-09-18 07:44:12 -05:00
parent ec62f654e0
commit 7e5fac5146
3 changed files with 32 additions and 32 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -96,6 +96,36 @@ export async function main(args: string[]): Promise<number> {
const successMessages: string[] = []
const errorMessages: string[] = []
// installing the specified tools
// loop over the tools and run their setup function
for (const tool of tools) {
// get the version or "true" or undefined for this tool from the options
const value = opts[tool]
// skip if undefined
if (value !== undefined) {
// get the setup function
const setupFunction = setups[tool]
// runnig the setup function for this tool
try {
// eslint-disable-next-line no-await-in-loop
const installationInfo = await setupFunction(getVersion(tool, value), setupCppDir, arch)
// preparing a report string
if (installationInfo !== undefined) {
successMessages.push(getSuccessMessage(tool, installationInfo))
} else {
successMessages.push(`${tool} was successfully installed`)
}
} catch (e) {
// push error message to the logger
errorMessages.push(`${tool} failed to install`)
}
}
}
// installing the specified compiler
const maybeCompiler = opts.compiler
try {
@ -147,36 +177,6 @@ export async function main(args: string[]): Promise<number> {
errorMessages.push(`Failed to install the ${maybeCompiler}`)
}
// installing the specified tools
// loop over the tools and run their setup function
for (const tool of tools) {
// get the version or "true" or undefined for this tool from the options
const value = opts[tool]
// skip if undefined
if (value !== undefined) {
// get the setup function
const setupFunction = setups[tool]
// runnig the setup function for this tool
try {
// eslint-disable-next-line no-await-in-loop
const installationInfo = await setupFunction(getVersion(tool, value), setupCppDir, arch)
// preparing a report string
if (installationInfo !== undefined) {
successMessages.push(getSuccessMessage(tool, installationInfo))
} else {
successMessages.push(`${tool} was successfully installed`)
}
} catch (e) {
// push error message to the logger
errorMessages.push(`${tool} failed to install`)
}
}
}
// report the messages in the end
successMessages.forEach((tool) => (isCI ? core.info(tool) : console.log(`\x1b[32m${tool}\x1b[0m`)))
errorMessages.forEach((tool) => (isCI ? core.error(tool) : console.log(`\x1b[31m${tool}\x1b[0m`)))