fix: prefer exe binaries for llvm on Windows

This commit is contained in:
Amin Yahyaabadi 2025-02-06 02:27:28 -08:00
parent 6f44503311
commit f5bc42aff8
5 changed files with 11 additions and 8 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

@ -7,7 +7,7 @@ import { arm64, armv7, powerpc64le, sparc64, sparcv9, x86, x86_64 } from "../uti
import { hasDnf } from "../utils/env/hasDnf.js"
import { isUbuntu } from "../utils/env/isUbuntu.js"
import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
import { extractExe, extractTarByExe } from "../utils/setup/extract.js"
import { extractExe, extractTarByExe, getArchiveType, getExtractFunction } from "../utils/setup/extract.js"
import type { PackageInfo } from "../utils/setup/setupBin.js"
const dirname = typeof __dirname === "string" ? __dirname : path.dirname(fileURLToPath(import.meta.url))
@ -26,7 +26,7 @@ export async function getLLVMPackageInfo(
binRelativeDir: "bin",
binFileName: addExeExt("clang"),
extractFunction: platform === "win32"
? extractExe
? getExtractFunction(getArchiveType(url))
: (file: string, dest: string) => {
return extractTarByExe(file, dest, 1)
},
@ -83,9 +83,11 @@ async function getAssetKeywords(platform: string, arch: string) {
switch (platform) {
case "win32": {
const osKeywordsChoice: string[] = ["windows", "Windows"]
// prefer exe over tar.xz for windows
optionalKeywords.push(".exe", ".exe")
const osKeywordsChoice: string[] = []
if (x86_64.includes(arch)) {
osKeywordsChoice.push("win64", "win64", "win64")
osKeywordsChoice.push("win64")
optionalKeywords.push(["x86_64", "X64"])
// TODO fallback to win32 if win64 is not available (e.g. for LLVM 3.6.2 and older)
} else if (x86.includes(arch)) {
@ -96,6 +98,7 @@ async function getAssetKeywords(platform: string, arch: string) {
info(`Using arch ${arch} for LLVM`)
osKeywordsChoice.push(arch)
}
osKeywordsChoice.push("windows", "Windows")
keywords.push(osKeywordsChoice)
break
}