Skip to content

Commit f0dd57e

Browse files
committed
fix: avoid old LLVM release HTTP redirects
1 parent fb2a9a2 commit f0dd57e

File tree

7 files changed

+25
-6
lines changed

7 files changed

+25
-6
lines changed

dist/legacy/setup-cpp.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.mjs

+1-1
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

+1-1
Large diffs are not rendered by default.

src/llvm/__tests__/llvm.test.ts

+17
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ describe("setup-llvm", () => {
8282
execaSync(main_exe, { cwd: dirname, stdio: "inherit" })
8383
})
8484

85+
it("should setup LLVM from llvm.org", async () => {
86+
const { binDir } = await setupLLVM("5", directory, process.arch)
87+
await testBin("clang++", ["--version"], binDir)
88+
89+
expect(process.env.CC?.includes("clang")).toBeTruthy()
90+
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
91+
92+
// test compilation
93+
const file = join(dirname, "main.cpp")
94+
const main_exe = join(dirname, addExeExt("main"))
95+
execaSync("clang++", [file, "-o", main_exe], { cwd: dirname })
96+
if (process.platform !== "win32") {
97+
await chmod(main_exe, "755")
98+
}
99+
execaSync(main_exe, { cwd: dirname, stdio: "inherit" })
100+
})
101+
85102
it("should setup clang-format", async () => {
86103
const osVersion = await ubuntuVersion()
87104
const { binDir } = await setupClangFormat(getVersion("llvm", "true", osVersion), directory, process.arch)

src/llvm/assets-list.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ async function main() {
2121
for (let major = 1; major <= 9; major++) {
2222
for (let minor = 0; minor <= 9; minor++) {
2323
for (let patch = 0; patch <= 9; patch++) {
24-
const version = `${major}.${minor}.${patch}`
24+
const version = (major >= 3 && minor >= 4 && patch >= 1)
25+
? `${major}.${minor}`
26+
: `${major}.${minor}.${patch}`
2527
yield [version, `https://releases.llvm.org/${version}`] as [string, string]
2628
}
2729
}

src/llvm/llvm_url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export async function getLLVMAssetURL(platform: string, arch: string, version: s
7171
)
7272

7373
if (websiteAsset !== undefined) {
74-
return `https://llvm.org/releases/${websiteAsset.tag}/${websiteAsset.name}`
74+
return `https://releases.llvm.org/${websiteAsset.tag}/${websiteAsset.name}`
7575
}
7676

7777
throw new Error(`No asset found for version ${version} matching ${keywords} and ${optionalKeywords}`)

0 commit comments

Comments
 (0)