Skip to content

Commit f11c322

Browse files
authored
Add deployment targets to the package manifest (#10)
Motivation: Core components of grpc-swift v2 require API from the latest SDKs. This causes a proliferation of availability annotations through our API. Rather than doing this we can set the minimum platforms in the package manifest. Modifications: - Remove availability annotations - Set platforms in the package manifest Result: - Less boilerplate - Users must set platforms in their package manifest
1 parent 54ce64b commit f11c322

File tree

74 files changed

+7
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+7
-167
lines changed

Package.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ let targets: [Target] = [
138138

139139
let package = Package(
140140
name: "grpc-swift-nio-transport",
141+
platforms: [
142+
.macOS(.v15),
143+
.iOS(.v18),
144+
.tvOS(.v18),
145+
.watchOS(.v11),
146+
.visionOS(.v2),
147+
],
141148
products: products,
142149
dependencies: dependencies,
143150
targets: targets

Sources/GRPCNIOTransportCore/Client/Connection/Connection.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ private import Synchronization
4343
/// }
4444
/// }
4545
/// ```
46-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
4746
package final class Connection: Sendable {
4847
/// Events which can happen over the lifetime of the connection.
4948
package enum Event: Sendable {
@@ -350,7 +349,6 @@ package final class Connection: Sendable {
350349
}
351350
}
352351

353-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
354352
extension Connection {
355353
package struct Stream {
356354
package typealias Inbound = NIOAsyncChannelInboundStream<RPCResponsePart>
@@ -412,7 +410,6 @@ extension Connection {
412410
}
413411
}
414412

415-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
416413
extension Connection {
417414
private enum State: Sendable {
418415
/// The connection is idle or connecting.

Sources/GRPCNIOTransportCore/Client/Connection/ConnectionBackoff.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1817
package struct ConnectionBackoff {
1918
package var initial: Duration
2019
package var max: Duration

Sources/GRPCNIOTransportCore/Client/Connection/ConnectionFactory.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,10 @@ package import NIOCore
1818
package import NIOHTTP2
1919
internal import NIOPosix
2020

21-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2221
package protocol HTTP2Connector: Sendable {
2322
func establishConnection(to address: SocketAddress) async throws -> HTTP2Connection
2423
}
2524

26-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2725
package struct HTTP2Connection: Sendable {
2826
/// The underlying TCP connection wrapped up for use with gRPC.
2927
var channel: NIOAsyncChannel<ClientConnectionEvent, Void>

Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ private import DequeModule
1818
package import GRPCCore
1919
private import Synchronization
2020

21-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2221
package final class GRPCChannel: ClientTransport {
2322
private enum Input: Sendable {
2423
/// Close the channel, if possible.
@@ -225,7 +224,6 @@ package final class GRPCChannel: ClientTransport {
225224
}
226225
}
227226

228-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
229227
extension GRPCChannel {
230228
package struct Config: Sendable {
231229
/// Configuration for HTTP/2 connections.
@@ -254,7 +252,6 @@ extension GRPCChannel {
254252
}
255253
}
256254

257-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
258255
extension GRPCChannel {
259256
enum MakeStreamResult {
260257
/// A stream was created, use it.
@@ -347,7 +344,6 @@ extension GRPCChannel {
347344
}
348345
}
349346

350-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
351347
extension GRPCChannel {
352348
private func handleClose(in group: inout DiscardingTaskGroup) {
353349
switch self.state.withLock({ $0.close() }) {
@@ -574,7 +570,6 @@ extension GRPCChannel {
574570
}
575571
}
576572

577-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
578573
extension GRPCChannel {
579574
struct StateMachine {
580575
enum State {
@@ -649,7 +644,6 @@ extension GRPCChannel {
649644
}
650645
}
651646

652-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
653647
extension GRPCChannel.StateMachine {
654648
mutating func start() {
655649
precondition(!self.running, "channel must only be started once")

Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/LoadBalancer.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
1817
package enum LoadBalancer: Sendable {
1918
case roundRobin(RoundRobinLoadBalancer)
2019
case pickFirst(PickFirstLoadBalancer)
2120
}
2221

23-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2422
extension LoadBalancer {
2523
package init(_ loadBalancer: RoundRobinLoadBalancer) {
2624
self = .roundRobin(loadBalancer)

Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/PickFirstLoadBalancer.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ private import Synchronization
5656
/// }
5757
/// }
5858
/// ```
59-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
6059
package final class PickFirstLoadBalancer: Sendable {
6160
enum Input: Sendable, Hashable {
6261
/// Update the addresses used by the load balancer to the following endpoints.
@@ -165,7 +164,6 @@ package final class PickFirstLoadBalancer: Sendable {
165164
}
166165
}
167166

168-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
169167
extension PickFirstLoadBalancer {
170168
private func handleUpdateEndpoint(_ endpoint: Endpoint, in group: inout DiscardingTaskGroup) {
171169
if endpoint.addresses.isEmpty { return }
@@ -266,7 +264,6 @@ extension PickFirstLoadBalancer {
266264
}
267265
}
268266

269-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
270267
extension PickFirstLoadBalancer {
271268
enum State: Sendable {
272269
case active(Active)
@@ -279,7 +276,6 @@ extension PickFirstLoadBalancer {
279276
}
280277
}
281278

282-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
283279
extension PickFirstLoadBalancer.State {
284280
struct Active: Sendable {
285281
var endpoint: Endpoint?
@@ -308,7 +304,6 @@ extension PickFirstLoadBalancer.State {
308304
}
309305
}
310306

311-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
312307
extension PickFirstLoadBalancer.State.Active {
313308
mutating func updateEndpoint(
314309
_ endpoint: Endpoint,
@@ -471,7 +466,6 @@ extension PickFirstLoadBalancer.State.Active {
471466
}
472467
}
473468

474-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
475469
extension PickFirstLoadBalancer.State.Closing {
476470
mutating func updateSubchannelConnectivityState(
477471
_ connectivityState: ConnectivityState,
@@ -512,7 +506,6 @@ extension PickFirstLoadBalancer.State.Closing {
512506
}
513507
}
514508

515-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
516509
extension PickFirstLoadBalancer.State {
517510
enum OnUpdateEndpoint {
518511
case connect(Subchannel, close: Subchannel?)

Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/RoundRobinLoadBalancer.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ private import NIOConcurrencyHelpers
5858
/// }
5959
/// }
6060
/// ```
61-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
6261
package final class RoundRobinLoadBalancer: Sendable {
6362
enum Input: Sendable, Hashable {
6463
/// Update the addresses used by the load balancer to the following endpoints.
@@ -198,7 +197,6 @@ package final class RoundRobinLoadBalancer: Sendable {
198197
}
199198
}
200199

201-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
202200
extension RoundRobinLoadBalancer {
203201
/// Handles an update in endpoints.
204202
///
@@ -340,7 +338,6 @@ extension RoundRobinLoadBalancer {
340338
}
341339
}
342340

343-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
344341
extension RoundRobinLoadBalancer {
345342
private enum State {
346343
case active(Active)

Sources/GRPCNIOTransportCore/Client/Connection/LoadBalancers/Subchannel.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ private import Synchronization
4343
/// }
4444
/// }
4545
/// ```
46-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
4746
package final class Subchannel: Sendable {
4847
package enum Event: Sendable, Hashable {
4948
/// The connection received a GOAWAY and will close soon. No new streams
@@ -117,7 +116,6 @@ package final class Subchannel: Sendable {
117116
}
118117
}
119118

120-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
121119
extension Subchannel {
122120
/// A stream of events which can happen to the subchannel.
123121
package var events: AsyncStream<Event> {
@@ -190,7 +188,6 @@ extension Subchannel {
190188
}
191189
}
192190

193-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
194191
extension Subchannel {
195192
private func handleConnectInput(in group: inout DiscardingTaskGroup) {
196193
let connection = self.state.withLock { state in
@@ -368,7 +365,6 @@ extension Subchannel {
368365
}
369366
}
370367

371-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
372368
extension Subchannel {
373369
/// ┌───────────────┐
374370
/// ┌───────▶│ NOT CONNECTED │───────────shutDown─────────────┐

Sources/GRPCNIOTransportCore/Client/Connection/RequestQueue.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
internal import DequeModule
1818

19-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2019
struct RequestQueue {
2120
typealias Continuation = CheckedContinuation<LoadBalancer, any Error>
2221

0 commit comments

Comments
 (0)