Skip to content

Commit

Permalink
fix: avoid old LLVM release HTTP redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 19, 2024
1 parent fb2a9a2 commit f0dd57e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.mjs.map

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/llvm/__tests__/llvm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/llvm/assets-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/llvm/llvm_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit f0dd57e

Please sign in to comment.