feat: support llvm 15

This commit is contained in:
Amin Yahyaabadi 2022-10-11 15:19:41 -07:00
parent ccb81ee5d7
commit 007a51ecba
4 changed files with 22 additions and 8 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

@ -54,6 +54,7 @@ describe("setup-llvm", () => {
it("Finds valid LLVM URLs", async () => { it("Finds valid LLVM URLs", async () => {
await Promise.all( await Promise.all(
[ [
"15",
// "14.0.1", // "14.0.1",
"14.0.0", "14.0.0",
"13.0.0", "13.0.0",

View File

@ -71,6 +71,9 @@ export const VERSIONS: Set<string> = getVersions([
"14.0.4", "14.0.4",
"14.0.5", "14.0.5",
"14.0.6", "14.0.6",
"15.0.0",
"15.0.1",
"15.0.2",
]) ])
//================================================ //================================================
@ -174,6 +177,7 @@ const UBUNTU_SUFFIX_MAP: { [key: string]: string } = {
"13.0.1-ubuntu-18.04": "-ubuntu-18.04", "13.0.1-ubuntu-18.04": "-ubuntu-18.04",
"14.0.0": "-ubuntu-18.04", "14.0.0": "-ubuntu-18.04",
// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le // "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
"15.0.2": "-rhel86",
} }
/** The latest supported LLVM version for the Linux (Ubuntu) platform. */ /** The latest supported LLVM version for the Linux (Ubuntu) platform. */
@ -188,25 +192,34 @@ export function getLinuxUrl(versionGiven: string): string {
version = rc version = rc
} }
let ubuntu: string let linuxVersion: string
// ubuntu-version is specified // ubuntu-version is specified
if (version.includes("ubuntu")) { if (version.includes("ubuntu")) {
const givenUbuntuVersion = version.replace(/-ubuntu-.*/, "") const givenUbuntuVersion = version.replace(/-ubuntu-.*/, "")
if (!VERSIONS.has(givenUbuntuVersion)) { if (!VERSIONS.has(givenUbuntuVersion)) {
throw new Error(`Unsupported Ubuntu version: ${givenUbuntuVersion}`) throw new Error(`Unsupported Ubuntu version: ${givenUbuntuVersion}`)
} }
ubuntu = version.replace(givenUbuntuVersion, "") linuxVersion = version.replace(givenUbuntuVersion, "")
version = getSpecificVersions(VERSIONS, givenUbuntuVersion)[0] version = getSpecificVersions(VERSIONS, givenUbuntuVersion)[0]
} else if (version !== "" && version in UBUNTU_SUFFIX_MAP) { } else if (version !== "" && version in UBUNTU_SUFFIX_MAP) {
ubuntu = UBUNTU_SUFFIX_MAP[version] linuxVersion = UBUNTU_SUFFIX_MAP[version]
} else { } else {
// default to the maximum version // default to the maximum version
ubuntu = UBUNTU_SUFFIX_MAP[MAX_UBUNTU] linuxVersion = UBUNTU_SUFFIX_MAP[MAX_UBUNTU]
warning(`Falling back to LLVM version ${MAX_UBUNTU} ${ubuntu} for the Ubuntu.`) warning(`Falling back to LLVM version ${MAX_UBUNTU} ${linuxVersion} for the Ubuntu.`)
} }
const prefix = "clang+llvm-" const prefix = "clang+llvm-"
const suffix = version === "5.0.0" ? `-linux-x86_64${ubuntu}.tar.xz` : `-x86_64-linux-gnu${ubuntu}.tar.xz`
let suffix: string
if (version === "5.0.0") {
suffix = `-linux-x86_64${linuxVersion}.tar.xz`
} else if (version === "15.0.2") {
suffix = `x86_64-unknown-linux-gnu${linuxVersion}.tar.xz`
} else {
suffix = `-x86_64-linux-gnu${linuxVersion}.tar.xz`
}
if (semverLte(version, "9.0.1")) { if (semverLte(version, "9.0.1")) {
return getReleaseUrl(version, prefix, suffix) return getReleaseUrl(version, prefix, suffix)
} else { } else {