Skip to content

Commit c57e698

Browse files
Manually specify xz path on macOS to /opt/homebrew/bin/xz
- We check if it exists, then try to use it if it does.
1 parent c63f6be commit c57e698

File tree

2 files changed

+15
-32
lines changed

2 files changed

+15
-32
lines changed

Sources/SwiftSDKGenerator/Generator/SwiftSDKGenerator+Download.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ extension SwiftSDKGenerator {
7373
])
7474
}
7575

76+
private func getXzPath() -> String? {
77+
#if os(macOS)
78+
let xzPath = "/opt/homebrew/bin/xz"
79+
#else
80+
let xzPath = "/usr/bin/xz"
81+
#endif
82+
83+
if doesFileExist(at: FilePath(xzPath)) {
84+
return xzPath
85+
}
86+
87+
return nil
88+
}
89+
7690
func downloadUbuntuPackages(
7791
_ client: some HTTPClientProtocol,
7892
_ engine: QueryEngine,
@@ -83,7 +97,7 @@ extension SwiftSDKGenerator {
8397
logger.debug("Parsing Ubuntu packages list...")
8498

8599
// Find xz path
86-
let xzPath = try await which("xz")
100+
let xzPath = getXzPath()
87101
if xzPath == nil {
88102
logger.warning("""
89103
The 'xz' utility was not found in path. \

Sources/SwiftSDKGenerator/SystemUtils/which.swift

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)