Skip to content

Commit

Permalink
Manually specify xz path on macOS to /opt/homebrew/bin/xz
Browse files Browse the repository at this point in the history
 - We check if it exists, then try to use it if it does.
  • Loading branch information
xtremekforever committed Feb 19, 2025
1 parent c63f6be commit c57e698
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ extension SwiftSDKGenerator {
])
}

private func getXzPath() -> String? {
#if os(macOS)
let xzPath = "/opt/homebrew/bin/xz"
#else
let xzPath = "/usr/bin/xz"
#endif

if doesFileExist(at: FilePath(xzPath)) {
return xzPath
}

return nil
}

func downloadUbuntuPackages(
_ client: some HTTPClientProtocol,
_ engine: QueryEngine,
Expand All @@ -83,7 +97,7 @@ extension SwiftSDKGenerator {
logger.debug("Parsing Ubuntu packages list...")

// Find xz path
let xzPath = try await which("xz")
let xzPath = getXzPath()
if xzPath == nil {
logger.warning("""
The 'xz' utility was not found in path. \
Expand Down
31 changes: 0 additions & 31 deletions Sources/SwiftSDKGenerator/SystemUtils/which.swift

This file was deleted.

0 comments on commit c57e698

Please sign in to comment.