@@ -7,7 +7,13 @@ import { loadAssetList, matchAsset } from "../utils/asset/load-assets.js"
77import { arm64 , armv7 , powerpc64le , sparc64 , sparcv9 , x86 , x86_64 } from "../utils/env/arch.js"
88import { hasDnf } from "../utils/env/hasDnf.js"
99import { ubuntuVersion } from "../utils/env/ubuntu_version.js"
10- import { extractTarByExe , getArchiveType , getExtractFunction } from "../utils/setup/extract.js"
10+ import {
11+ ArchiveType ,
12+ extract7Zip ,
13+ extractTarByExe ,
14+ getArchiveType ,
15+ getExtractFunction ,
16+ } from "../utils/setup/extract.js"
1117import type { PackageInfo } from "../utils/setup/setupBin.js"
1218
1319const dirname = typeof __dirname === "string" ? __dirname : path . dirname ( fileURLToPath ( import . meta. url ) )
@@ -20,16 +26,20 @@ export async function getLLVMPackageInfo(
2026 const url = await getLLVMAssetURL ( platform , arch , version )
2127 info ( `Downloading LLVM from ${ url } ` )
2228
29+ const archiveType = getArchiveType ( url )
2330 return {
2431 url,
2532 extractedFolderName : "" ,
2633 binRelativeDir : "bin" ,
2734 binFileName : addExeExt ( "clang" ) ,
28- extractFunction : platform === "win32"
29- ? getExtractFunction ( getArchiveType ( url ) )
30- : ( file : string , dest : string ) => {
31- return extractTarByExe ( file , dest , 1 )
32- } ,
35+ extractFunction :
36+ ( archiveType === ArchiveType . Tar || archiveType === ArchiveType . TarGz || archiveType === ArchiveType . TarXz )
37+ ? ( file : string , dest : string ) => {
38+ return process . platform === "win32"
39+ ? extract7Zip ( file , dest , true )
40+ : extractTarByExe ( file , dest , 1 )
41+ }
42+ : getExtractFunction ( archiveType ) ,
3343 }
3444}
3545
@@ -83,8 +93,8 @@ async function getAssetKeywords(platform: string, arch: string) {
8393
8494 switch ( platform ) {
8595 case "win32" : {
86- // prefer exe over tar.xz for windows
87- optionalKeywords . push ( ".exe " , ".exe " )
96+ // prefer tar.xz packages of LLVM over exe as they provide a more complete LLVM package
97+ optionalKeywords . push ( ".tar.xz " , ".tar.xz " )
8898 const osKeywordsChoice : string [ ] = [ ]
8999 if ( x86_64 . includes ( arch ) ) {
90100 osKeywordsChoice . push ( "win64" )
0 commit comments