From 6a69f8d7f674fcf6bcb9ceef3908beb35c48b7d6 Mon Sep 17 00:00:00 2001 From: justiceadams Date: Tue, 16 Sep 2025 13:45:04 -0700 Subject: [PATCH] use HTTPRequestExecutorImpl client for libarchive --- Sources/SwiftlyCore/HTTPClient.swift | 2 +- Tools/build-swiftly-release/BuildSwiftlyRelease.swift | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/SwiftlyCore/HTTPClient.swift b/Sources/SwiftlyCore/HTTPClient.swift index b47b873b..556d1b24 100644 --- a/Sources/SwiftlyCore/HTTPClient.swift +++ b/Sources/SwiftlyCore/HTTPClient.swift @@ -110,7 +110,7 @@ struct SwiftlyUserAgentMiddleware: ClientMiddleware { /// An `HTTPRequestExecutor` backed by a shared `HTTPClient`. This makes actual network requests. public final class HTTPRequestExecutorImpl: HTTPRequestExecutor { - let httpClient: HTTPClient + public let httpClient: HTTPClient public init() { var proxy: HTTPClient.Configuration.Proxy? diff --git a/Tools/build-swiftly-release/BuildSwiftlyRelease.swift b/Tools/build-swiftly-release/BuildSwiftlyRelease.swift index 2a7f8c94..a9257483 100644 --- a/Tools/build-swiftly-release/BuildSwiftlyRelease.swift +++ b/Tools/build-swiftly-release/BuildSwiftlyRelease.swift @@ -150,8 +150,9 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { try? await fs.remove(atPath: libArchivePath) // Download libarchive + let httpExecutor = HTTPRequestExecutorImpl() let libarchiveRequest = HTTPClientRequest(url: "https://github.com/libarchive/libarchive/releases/download/v\(libArchiveVersion)/libarchive-\(libArchiveVersion).tar.gz") - let libarchiveResponse = try await HTTPClient.shared.execute(libarchiveRequest, timeout: .seconds(60)) + let libarchiveResponse = try await httpExecutor.httpClient.execute(libarchiveRequest, timeout: .seconds(60)) guard libarchiveResponse.status == .ok else { throw Error(message: "Download failed with status: \(libarchiveResponse.status)") } @@ -180,8 +181,6 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { } let swiftVersion = swiftVerMatch.output.1 - - let httpExecutor = HTTPRequestExecutorImpl() guard let swiftRelease = (try await httpExecutor.getReleaseToolchains()).first(where: { $0.name == swiftVersion }) else { throw Error(message: "Unable to find swift release using swift.org API: \(swiftVersion)") }