fix: avoid old LLVM release HTTP redirects

This commit is contained in:
Amin Yahyaabadi 2024-09-18 17:30:09 -07:00
parent fb2a9a2418
commit f0dd57ea4d
No known key found for this signature in database
GPG Key ID: F52AF77F636088F0
7 changed files with 25 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -82,6 +82,23 @@ describe("setup-llvm", () => {
execaSync(main_exe, { cwd: dirname, stdio: "inherit" })
})
it("should setup LLVM from llvm.org", async () => {
const { binDir } = await setupLLVM("5", directory, process.arch)
await testBin("clang++", ["--version"], binDir)
expect(process.env.CC?.includes("clang")).toBeTruthy()
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
// test compilation
const file = join(dirname, "main.cpp")
const main_exe = join(dirname, addExeExt("main"))
execaSync("clang++", [file, "-o", main_exe], { cwd: dirname })
if (process.platform !== "win32") {
await chmod(main_exe, "755")
}
execaSync(main_exe, { cwd: dirname, stdio: "inherit" })
})
it("should setup clang-format", async () => {
const osVersion = await ubuntuVersion()
const { binDir } = await setupClangFormat(getVersion("llvm", "true", osVersion), directory, process.arch)

View File

@ -21,7 +21,9 @@ async function main() {
for (let major = 1; major <= 9; major++) {
for (let minor = 0; minor <= 9; minor++) {
for (let patch = 0; patch <= 9; patch++) {
const version = `${major}.${minor}.${patch}`
const version = (major >= 3 && minor >= 4 && patch >= 1)
? `${major}.${minor}`
: `${major}.${minor}.${patch}`
yield [version, `https://releases.llvm.org/${version}`] as [string, string]
}
}

View File

@ -71,7 +71,7 @@ export async function getLLVMAssetURL(platform: string, arch: string, version: s
)
if (websiteAsset !== undefined) {
return `https://llvm.org/releases/${websiteAsset.tag}/${websiteAsset.name}`
return `https://releases.llvm.org/${websiteAsset.tag}/${websiteAsset.name}`
}
throw new Error(`No asset found for version ${version} matching ${keywords} and ${optionalKeywords}`)