Skip to content

Commit

Permalink
Update async-http-client Package (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jagreenwood authored Jan 26, 2024
1 parent ff1b013 commit c7f7420
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 32 deletions.
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "Swift",
"image": "swift:5.9.1",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "false",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "false"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "os-provided",
"ppa": "false"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.library": "/usr/lib/liblldb.so"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"sswg.swift-lang"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "swift --version",

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
/Package.resolved
.vscode
124 changes: 124 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"object": {
"pins": [
{
"package": "async-http-client",
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
"state": {
"branch": null,
"revision": "291438696abdd48d2a83b52465c176efbd94512b",
"version": "1.20.1"
}
},
{
"package": "swift-algorithms",
"repositoryURL": "https://github.com/apple/swift-algorithms",
"state": {
"branch": null,
"revision": "f6919dfc309e7f1b56224378b11e28bab5bccc42",
"version": "1.2.0"
}
},
{
"package": "swift-atomics",
"repositoryURL": "https://github.com/apple/swift-atomics.git",
"state": {
"branch": null,
"revision": "cd142fd2f64be2100422d658e7411e39489da985",
"version": "1.2.0"
}
},
{
"package": "swift-collections",
"repositoryURL": "https://github.com/apple/swift-collections.git",
"state": {
"branch": null,
"revision": "d029d9d39c87bed85b1c50adee7c41795261a192",
"version": "1.0.6"
}
},
{
"package": "swift-http-types",
"repositoryURL": "https://github.com/apple/swift-http-types",
"state": {
"branch": null,
"revision": "12358d55a3824bd5fed310b999ea8cf83a9a1a65",
"version": "1.0.3"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version": "1.5.4"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "635b2589494c97e48c62514bc8b37ced762e0a62",
"version": "2.63.0"
}
},
{
"package": "swift-nio-extras",
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
"state": {
"branch": null,
"revision": "363da63c1966405764f380c627409b2f9d9e710b",
"version": "1.21.0"
}
},
{
"package": "swift-nio-http2",
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
"state": {
"branch": null,
"revision": "0904bf0feb5122b7e5c3f15db7df0eabe623dd87",
"version": "1.30.0"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "7c381eb6083542b124a6c18fae742f55001dc2b5",
"version": "2.26.0"
}
},
{
"package": "swift-nio-transport-services",
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
"state": {
"branch": null,
"revision": "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce",
"version": "1.20.1"
}
},
{
"package": "swift-numerics",
"repositoryURL": "https://github.com/apple/swift-numerics.git",
"state": {
"branch": null,
"revision": "0a5bc04095a675662cf24757cc0640aa2204253b",
"version": "1.0.2"
}
},
{
"package": "swift-system",
"repositoryURL": "https://github.com/apple/swift-system.git",
"state": {
"branch": null,
"revision": "025bcb1165deab2e20d4eaba79967ce73013f496",
"version": "1.2.1"
}
}
]
},
"version": 1
}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let package = Package(
)

#if os(Linux)
package.dependencies.append(.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.9.0"))
package.dependencies.append(.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.19.0"))
package.targets.first { $0.name == "OpenWeatherKit" }?.dependencies.append(.product(name: "AsyncHTTPClient", package: "async-http-client"))
#endif

Expand Down

This file was deleted.

13 changes: 4 additions & 9 deletions Sources/OpenWeatherKit/Public/WeatherService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,16 @@ final public class WeatherService: Sendable {
public var jwt: @Sendable () -> String
public var language: Language
#if os(Linux)
public var eventLoopGroupProvider: NIOEventLoopGroupProvider

@available(*, deprecated, renamed: "init(jwt:language:)")
public init(
jwt: @escaping @Sendable () -> String,
language: WeatherService.Configuration.Language = .englishUS,
eventLoopGroupProvider: NIOEventLoopGroupProvider = .createNew
eventLoopGroupProvider: NIOEventLoopGroupProvider
) {
self.jwt = jwt
self.language = language
self.eventLoopGroupProvider = eventLoopGroupProvider
}
#else
#endif
/// Initializes an instance of Configuation
/// - Parameters:
/// - jwt: A closure to provide a JWT.
Expand All @@ -57,7 +55,6 @@ final public class WeatherService: Sendable {
self.jwt = jwt
self.language = language
}
#endif
}

@usableFromInline
Expand Down Expand Up @@ -94,9 +91,7 @@ final public class WeatherService: Sendable {
public init(configuration: Configuration) {
Self.configuration = configuration
self.networkClient = NetworkClient(
client: HTTPClient(
eventLoopGroupProvider: configuration.eventLoopGroupProvider.eventLoopGroupProvider
)
client: HTTPClient(eventLoopGroupProvider: .singleton)
)
}

Expand Down

0 comments on commit c7f7420

Please sign in to comment.