Skip to content

Commit f5bc42a

Browse files
committed
fix: prefer exe binaries for llvm on Windows
1 parent 6f44503 commit f5bc42a

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/llvm/llvm_url.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { arm64, armv7, powerpc64le, sparc64, sparcv9, x86, x86_64 } from "../uti
77
import { hasDnf } from "../utils/env/hasDnf.js"
88
import { isUbuntu } from "../utils/env/isUbuntu.js"
99
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
10-
import { extractExe, extractTarByExe } from "../utils/setup/extract.js"
10+
import { extractExe, extractTarByExe, getArchiveType, getExtractFunction } from "../utils/setup/extract.js"
1111
import type { PackageInfo } from "../utils/setup/setupBin.js"
1212

1313
const dirname = typeof __dirname === "string" ? __dirname : path.dirname(fileURLToPath(import.meta.url))
@@ -26,7 +26,7 @@ export async function getLLVMPackageInfo(
2626
binRelativeDir: "bin",
2727
binFileName: addExeExt("clang"),
2828
extractFunction: platform === "win32"
29-
? extractExe
29+
? getExtractFunction(getArchiveType(url))
3030
: (file: string, dest: string) => {
3131
return extractTarByExe(file, dest, 1)
3232
},
@@ -83,9 +83,11 @@ async function getAssetKeywords(platform: string, arch: string) {
8383

8484
switch (platform) {
8585
case "win32": {
86-
const osKeywordsChoice: string[] = ["windows", "Windows"]
86+
// prefer exe over tar.xz for windows
87+
optionalKeywords.push(".exe", ".exe")
88+
const osKeywordsChoice: string[] = []
8789
if (x86_64.includes(arch)) {
88-
osKeywordsChoice.push("win64", "win64", "win64")
90+
osKeywordsChoice.push("win64")
8991
optionalKeywords.push(["x86_64", "X64"])
9092
// TODO fallback to win32 if win64 is not available (e.g. for LLVM 3.6.2 and older)
9193
} else if (x86.includes(arch)) {
@@ -96,6 +98,7 @@ async function getAssetKeywords(platform: string, arch: string) {
9698
info(`Using arch ${arch} for LLVM`)
9799
osKeywordsChoice.push(arch)
98100
}
101+
osKeywordsChoice.push("windows", "Windows")
99102
keywords.push(osKeywordsChoice)
100103
break
101104
}

0 commit comments

Comments
 (0)