mirror of https://github.com/aminya/setup-cpp
fix: inline defaultLLVMVersion
This commit is contained in:
parent
8a16afc589
commit
d2eafaab01
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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]
|
||||||
|
} else {
|
||||||
|
return version ?? ""
|
||||||
}
|
}
|
||||||
return DefaultVersions[name]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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-"
|
||||||
|
|
Loading…
Reference in New Issue