Browse Source

availability guard usages of async stream (#1705)

Rick Newton-Rogers 2 years ago
parent
commit
8a5cb56a04

+ 1 - 0
Sources/GRPCCore/Streaming/Internal/AsyncStream+MakeStream.swift

@@ -15,6 +15,7 @@
  */
 
 #if swift(<5.9)
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 extension AsyncStream {
   @inlinable
   static func makeStream(

+ 1 - 0
Tests/GRPCCoreTests/Call/Client/ClientRequestTests.swift

@@ -18,6 +18,7 @@ import XCTest
 
 @testable import GRPCCore
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 final class ClientRequestTests: XCTestCase {
   func testSingleToStreamConversion() async throws {
     let (messages, continuation) = AsyncStream.makeStream(of: String.self)

+ 2 - 0
Tests/GRPCCoreTests/Call/Client/Internal/ClientRPCExecutorTestSupport/ClientRPCExecutorTestHarness+Transport.swift

@@ -19,6 +19,7 @@ import Atomics
 
 // TODO: replace with real in-process transport
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 final class TestingClientTransport: ClientTransport, Sendable {
   typealias Inbound = RPCAsyncSequence<RPCResponsePart>
   typealias Outbound = RPCWriter<RPCRequestPart>.Closable
@@ -130,6 +131,7 @@ final class TestingClientTransport: ClientTransport, Sendable {
   }
 }
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 final class TestingServerTransport: ServerTransport, Sendable {
   typealias Inbound = RPCAsyncSequence<RPCRequestPart>
   typealias Outbound = RPCWriter<RPCResponsePart>.Closable

+ 1 - 0
Tests/GRPCCoreTests/Call/Client/Internal/ClientRPCExecutorTestSupport/ClientRPCExecutorTestHarness.swift

@@ -24,6 +24,7 @@ import XCTest
 /// of the server to allow for flexible testing scenarios with minimal boilerplate. The harness
 /// also tracks how many streams the client has opened, how many streams the server accepted, and
 /// how many streams the client failed to open.
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 struct ClientRPCExecutorTestHarness {
   private let server: ServerStreamHandler
   private let clientTransport: StreamCountingClientTransport

+ 2 - 0
Tests/GRPCCoreTests/Call/Client/Internal/ClientRPCExecutorTestSupport/ClientRPCExecutorTestHasness+ServerBehavior.swift

@@ -18,6 +18,7 @@ import XCTest
 
 @testable import GRPCCore
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 extension ClientRPCExecutorTestHarness {
   struct ServerStreamHandler: Sendable {
     private let handler:
@@ -47,6 +48,7 @@ extension ClientRPCExecutorTestHarness {
   }
 }
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 extension ClientRPCExecutorTestHarness.ServerStreamHandler {
   static var echo: Self {
     return Self {

+ 1 - 0
Tests/GRPCCoreTests/Call/Client/Internal/ClientRPCExecutorTests.swift

@@ -16,6 +16,7 @@
 import GRPCCore
 import XCTest
 
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
 final class ClientRPCExecutorTests: XCTestCase {
   func testUnaryEcho() async throws {
     let tester = ClientRPCExecutorTestHarness(server: .echo)