fix: inline defaultLLVMVersion

This commit is contained in:
Amin Yahyaabadi 2022-05-03 00:46:03 -07:00
parent 8a16afc589
commit d2eafaab01
4 changed files with 9 additions and 13 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

@ -22,15 +22,8 @@ let ubuntuVersionCached: number[] | null = null
/** Get the default version if passed true or undefined, otherwise return the version itself */
export function getVersion(name: string, version: string | undefined) {
if (version === "true" || (version === undefined && name in DefaultVersions)) {
return DefaultVersions[name]
} else {
return version ?? ""
}
}
export function defaultLLVMVersion(name: string) {
if (["llvm", "clangtidy", "clangformat"].includes(name)) {
if (process.platform === "linux") {
// llvm on linux
if (process.platform === "linux" && ["llvm", "clangtidy", "clangformat"].includes(name)) {
try {
// get the version if not already done
ubuntuVersionCached = ubuntuVersionCached ?? ubuntuVersion()
@ -45,6 +38,9 @@ export function defaultLLVMVersion(name: string) {
}
}
}
// anything else
return DefaultVersions[name]
} else {
return version ?? ""
}
return DefaultVersions[name]
}

View File

@ -184,7 +184,7 @@ function getLinuxUrl(versionGiven: string): string {
} else {
// default to the maximum version
ubuntu = UBUNTU_SUFFIX_MAP[MAX_UBUNTU]
warning(`Falling back to LLVM version ${ubuntu} for the Ubuntu.`)
warning(`Falling back to LLVM version ${MAX_UBUNTU} ${ubuntu} for the Ubuntu.`)
}
const prefix = "clang+llvm-"