Skip to content

Commit

Permalink
fix: prefer exe binaries for llvm on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Feb 6, 2025
1 parent 6f44503 commit f5bc42a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 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.

11 changes: 7 additions & 4 deletions src/llvm/llvm_url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Check warning on line 10 in src/llvm/llvm_url.ts

View workflow job for this annotation

GitHub Actions / Build (ubuntu-22.04)

'extractExe' is defined but never used. Allowed unused vars must match /^_/u
import type { PackageInfo } from "../utils/setup/setupBin.js"

const dirname = typeof __dirname === "string" ? __dirname : path.dirname(fileURLToPath(import.meta.url))
Expand All @@ -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)
},
Expand Down Expand Up @@ -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)) {
Expand All @@ -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
}
Expand Down

0 comments on commit f5bc42a

Please sign in to comment.