Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftlyCore/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
5 changes: 2 additions & 3 deletions Tools/build-swiftly-release/BuildSwiftlyRelease.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: this looks good for cases where the build script is run in a http proxy environment.

thought: Maybe we should have a workflow that verifies that this build script works in such an environment. I'm not quite sure how to configure Linux so that the network traffic will be blocked unless it goes through a proxy.

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)")
}
Expand Down Expand Up @@ -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)")
}
Expand Down