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

View File

@ -184,7 +184,7 @@ function getLinuxUrl(versionGiven: string): string {
} else { } else {
// default to the maximum version // default to the maximum version
ubuntu = UBUNTU_SUFFIX_MAP[MAX_UBUNTU] 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-" const prefix = "clang+llvm-"