Skip to content

Commit 10725f0

Browse files
authored
Add deployment targets to the package manifest (#7)
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 6344b20 commit 10725f0

19 files changed

+7
-42
lines changed

Package.swift

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

117117
let package = Package(
118118
name: "grpc-swift-extras",
119+
platforms: [
120+
.macOS(.v15),
121+
.iOS(.v18),
122+
.tvOS(.v18),
123+
.watchOS(.v11),
124+
.visionOS(.v2),
125+
],
119126
products: products,
120127
dependencies: dependencies,
121128
targets: targets

Sources/GRPCHealthService/Health.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public import GRPCCore
4040
/// forService: .bar_Foo
4141
/// )
4242
/// ```
43-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
4443
public struct Health: Sendable {
4544
/// An implementation of the `grpc.health.v1.Health` service.
4645
public let service: Health.Service
@@ -58,7 +57,6 @@ public struct Health: Sendable {
5857
}
5958
}
6059

61-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
6260
extension Health {
6361
/// An implementation of the `grpc.health.v1.Health` service.
6462
public struct Service: RegistrableRPCService, Sendable {

Sources/GRPCHealthService/HealthService.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
internal import GRPCCore
1818
private import Synchronization
1919

20-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2120
internal struct HealthService: Grpc_Health_V1_Health_ServiceProtocol {
2221
private let state = HealthService.State()
2322

@@ -66,7 +65,6 @@ internal struct HealthService: Grpc_Health_V1_Health_ServiceProtocol {
6665
}
6766
}
6867

69-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
7068
extension HealthService {
7169
private final class State: Sendable {
7270
// The state of each service keyed by the fully qualified service name.

Sources/GRPCInterceptors/ClientTracingInterceptor.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ internal import Tracing
2323
/// metadata. It will then be picked up by the server-side ``ServerTracingInterceptor``.
2424
///
2525
/// For more information, refer to the documentation for `swift-distributed-tracing`.
26-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2726
public struct ClientTracingInterceptor: ClientInterceptor {
2827
private let injector: ClientRequestInjector
2928
private let emitEventOnEachWrite: Bool
@@ -132,7 +131,6 @@ public struct ClientTracingInterceptor: ClientInterceptor {
132131

133132
/// An injector responsible for injecting the required instrumentation keys from the `ServiceContext` into
134133
/// the request metadata.
135-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
136134
struct ClientRequestInjector: Instrumentation.Injector {
137135
typealias Carrier = Metadata
138136

Sources/GRPCInterceptors/HookedWriter.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
internal import GRPCCore
1717
internal import Tracing
1818

19-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
2019
struct HookedWriter<Element: Sendable>: RPCWriterProtocol {
2120
private let writer: any RPCWriterProtocol<Element>
2221
private let beforeEachWrite: @Sendable () -> Void

Sources/GRPCInterceptors/OnFinishAsyncSequence.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 10.15, iOS 13, tvOS 13, watchOS 6, *)
1817
struct OnFinishAsyncSequence<Element: Sendable>: AsyncSequence, Sendable {
1918
private let _makeAsyncIterator: @Sendable () -> AsyncIterator
2019

Sources/GRPCInterceptors/ServerTracingInterceptor.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ internal import Tracing
2121
///
2222
/// The extracted tracing information is made available to user code via the current `ServiceContext`.
2323
/// For more information, refer to the documentation for `swift-distributed-tracing`.
24-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2524
public struct ServerTracingInterceptor: ServerInterceptor {
2625
private let extractor: ServerRequestExtractor
2726
private let emitEventOnEachWrite: Bool
@@ -136,7 +135,6 @@ public struct ServerTracingInterceptor: ServerInterceptor {
136135
}
137136

138137
/// An extractor responsible for extracting the required instrumentation keys from request metadata.
139-
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
140138
struct ServerRequestExtractor: Instrumentation.Extractor {
141139
typealias Carrier = Metadata
142140

Sources/GRPCInteropTests/InteroperabilityTestCase.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
public import GRPCCore
1717

18-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
1918
public protocol InteroperabilityTest {
2019
/// Run a test case using the given connection.
2120
///
@@ -69,7 +68,6 @@ public enum InteroperabilityTestCase: String, CaseIterable, Sendable {
6968
}
7069
}
7170

72-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
7371
extension InteroperabilityTestCase {
7472
/// Return a new instance of the test case.
7573
public func makeTest() -> any InteroperabilityTest {

Sources/GRPCInteropTests/InteroperabilityTestCases.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ private import struct Foundation.Data
3131
/// Client asserts:
3232
/// - call was successful
3333
/// - response is non-null
34-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
3534
struct EmptyUnary: InteroperabilityTest {
3635
func run(client: GRPCClient) async throws {
3736
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -65,7 +64,6 @@ struct EmptyUnary: InteroperabilityTest {
6564
/// - response payload body is 314159 bytes in size
6665
/// - clients are free to assert that the response payload body contents are zero and comparing
6766
/// the entire response message against a golden response
68-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
6967
struct LargeUnary: InteroperabilityTest {
7068
func run(client: GRPCClient) async throws {
7169
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -141,7 +139,6 @@ struct LargeUnary: InteroperabilityTest {
141139
/// - Response payload body is 314159 bytes in size.
142140
/// - Clients are free to assert that the response payload body contents are zeros and comparing the
143141
/// entire response message against a golden response.
144-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
145142
class ClientCompressedUnary: InteroperabilityTest {
146143
func run(client: GRPCClient) async throws {
147144
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -250,7 +247,6 @@ class ClientCompressedUnary: InteroperabilityTest {
250247
/// - response payload body is 314159 bytes in size in both cases.
251248
/// - clients are free to assert that the response payload body contents are zero and comparing the
252249
/// entire response message against a golden response
253-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
254250
class ServerCompressedUnary: InteroperabilityTest {
255251
func run(client: GRPCClient) async throws {
256252
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -340,7 +336,6 @@ class ServerCompressedUnary: InteroperabilityTest {
340336
/// Client asserts:
341337
/// - call was successful
342338
/// - response aggregated_payload_size is 74922
343-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
344339
struct ClientStreaming: InteroperabilityTest {
345340
func run(client: GRPCClient) async throws {
346341
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -391,7 +386,6 @@ struct ClientStreaming: InteroperabilityTest {
391386
/// - response payload bodies are sized (in order): 31415, 9, 2653, 58979
392387
/// - clients are free to assert that the response payload body contents are zero and
393388
/// comparing the entire response messages against golden responses
394-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
395389
struct ServerStreaming: InteroperabilityTest {
396390
func run(client: GRPCClient) async throws {
397391
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -468,7 +462,6 @@ struct ServerStreaming: InteroperabilityTest {
468462
/// - clients are free to assert that the response payload body contents are zero and comparing the
469463
/// entire response messages against golden responses
470464
class ServerCompressedStreaming: InteroperabilityTest {
471-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
472465
func run(client: GRPCClient) async throws {
473466
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
474467
let request: Grpc_Testing_StreamingOutputCallRequest = .with { request in
@@ -580,7 +573,6 @@ class ServerCompressedStreaming: InteroperabilityTest {
580573
/// - response payload bodies are sized (in order): 31415, 9, 2653, 58979
581574
/// - clients are free to assert that the response payload body contents are zero and
582575
/// comparing the entire response messages against golden responses
583-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
584576
struct PingPong: InteroperabilityTest {
585577
func run(client: GRPCClient) async throws {
586578
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -647,7 +639,6 @@ struct PingPong: InteroperabilityTest {
647639
/// Client asserts:
648640
/// - call was successful
649641
/// - exactly zero responses
650-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
651642
struct EmptyStream: InteroperabilityTest {
652643
func run(client: GRPCClient) async throws {
653644
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -703,7 +694,6 @@ struct EmptyStream: InteroperabilityTest {
703694
/// received in the initial metadata for calls in Procedure steps 1 and 2.
704695
/// - metadata with key "x-grpc-test-echo-trailing-bin" and value 0xababab is received in the
705696
/// trailing metadata for calls in Procedure steps 1 and 2.
706-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
707697
struct CustomMetadata: InteroperabilityTest {
708698
let initialMetadataName = "x-grpc-test-echo-initial"
709699
let initialMetadataValue = "test_initial_metadata_value"
@@ -824,7 +814,6 @@ struct CustomMetadata: InteroperabilityTest {
824814
/// Client asserts:
825815
/// - received status code is the same as the sent code for both Procedure steps 1 and 2
826816
/// - received status message is the same as the sent message for both Procedure steps 1 and 2
827-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
828817
struct StatusCodeAndMessage: InteroperabilityTest {
829818
let expectedCode = 2
830819
let expectedMessage = "test status message"
@@ -902,7 +891,6 @@ struct StatusCodeAndMessage: InteroperabilityTest {
902891
/// - received status code is the same as the sent code for Procedure step 1
903892
/// - received status message is the same as the sent message for Procedure step 1, including all
904893
/// whitespace characters
905-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
906894
struct SpecialStatusMessage: InteroperabilityTest {
907895
func run(client: GRPCClient) async throws {
908896
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -945,7 +933,6 @@ struct SpecialStatusMessage: InteroperabilityTest {
945933
///
946934
/// Client asserts:
947935
/// - received status code is 12 (UNIMPLEMENTED)
948-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
949936
struct UnimplementedMethod: InteroperabilityTest {
950937
func run(client: GRPCClient) async throws {
951938
let testServiceClient = Grpc_Testing_TestService.Client(wrapping: client)
@@ -978,7 +965,6 @@ struct UnimplementedMethod: InteroperabilityTest {
978965
///
979966
/// Client asserts:
980967
/// - received status code is 12 (UNIMPLEMENTED)
981-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
982968
struct UnimplementedService: InteroperabilityTest {
983969
func run(client: GRPCClient) async throws {
984970
let unimplementedServiceClient = Grpc_Testing_UnimplementedService.Client(wrapping: client)

Sources/GRPCInteropTests/TestService.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
private import Foundation
1818
public import GRPCCore
1919

20-
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
2120
public struct TestService: Grpc_Testing_TestService.ServiceProtocol {
2221
public init() {}
2322

0 commit comments

Comments
 (0)