Browse Source

Update platform names (#1932)

woxtu 1 year ago
parent
commit
2a62be5ea5

+ 15 - 15
Sources/GRPC/PlatformSupport.swift

@@ -57,7 +57,7 @@ public struct NetworkImplementation: Hashable {
 
   #if canImport(Network)
   /// Network.framework (NIOTransportServices).
-  @available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+  @available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
   public static let networkFramework = NetworkImplementation(.networkFramework)
   #endif
 
@@ -66,7 +66,7 @@ public struct NetworkImplementation: Hashable {
 
   internal static func matchingEventLoopGroup(_ group: EventLoopGroup) -> NetworkImplementation {
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
       if PlatformSupport.isTransportServicesEventLoopGroup(group) {
         return .networkFramework
       }
@@ -84,13 +84,13 @@ extension NetworkPreference {
   /// This isn't directly useful when implementing code which branches on the network preference
   /// since that code will still need the appropriate availability check:
   ///
-  /// - `@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)`, or
-  /// - `#available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)`.
+  /// - `@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)`, or
+  /// - `#available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)`.
   public var implementation: NetworkImplementation {
     switch self.wrapped {
     case .best:
       #if canImport(Network)
-      if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+      if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
         return .networkFramework
       } else {
         // Older platforms must use the POSIX loop.
@@ -136,7 +136,7 @@ extension ClientBootstrapProtocol {
 extension ClientBootstrap: ClientBootstrapProtocol {}
 
 #if canImport(Network)
-@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
 extension NIOTSConnectionBootstrap: ClientBootstrapProtocol {
   public func withConnectedSocket(_ socket: NIOBSDSocket.Handle) -> EventLoopFuture<Channel> {
     preconditionFailure("NIOTSConnectionBootstrap does not support withConnectedSocket(_:)")
@@ -182,7 +182,7 @@ extension ServerBootstrapProtocol {
 extension ServerBootstrap: ServerBootstrapProtocol {}
 
 #if canImport(Network)
-@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
 extension NIOTSListenerBootstrap: ServerBootstrapProtocol {
   public func withBoundSocket(_ connectedSocket: NIOBSDSocket.Handle) -> EventLoopFuture<Channel> {
     preconditionFailure("NIOTSListenerBootstrap does not support withBoundSocket(_:)")
@@ -213,7 +213,7 @@ public enum PlatformSupport {
     switch networkPreference.implementation.wrapped {
     case .networkFramework:
       #if canImport(Network)
-      guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else {
+      guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else {
         logger.critical("Network.framework can be imported but is not supported on this platform")
         // This is gated by the availability of `.networkFramework` so should never happen.
         fatalError(".networkFramework is being used on an unsupported platform")
@@ -241,7 +241,7 @@ public enum PlatformSupport {
   ) -> ClientBootstrapProtocol {
     logger.debug("making client bootstrap with event loop group of type \(type(of: group))")
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
       if isTransportServicesEventLoopGroup(group) {
         logger.debug(
           "Network.framework is available and the EventLoopGroup is compatible with NIOTS, creating a NIOTSConnectionBootstrap"
@@ -260,7 +260,7 @@ public enum PlatformSupport {
 
   internal static func isTransportServicesEventLoopGroup(_ group: EventLoopGroup) -> Bool {
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
       return group is NIOTSEventLoopGroup || group is QoSEventLoop
     }
     #endif
@@ -279,7 +279,7 @@ public enum PlatformSupport {
     }
 
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *),
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *),
       let transportServicesBootstrap = bootstrap as? NIOTSConnectionBootstrap
     {
       return transportServicesBootstrap.tlsOptions(from: tlsConfigruation)
@@ -301,7 +301,7 @@ public enum PlatformSupport {
   ) -> ServerBootstrapProtocol {
     logger.debug("making server bootstrap with event loop group of type \(type(of: group))")
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
       if let tsGroup = group as? NIOTSEventLoopGroup {
         logger
           .debug(
@@ -330,7 +330,7 @@ public enum PlatformSupport {
   /// See https://github.com/apple/swift-nio-transport-services/pull/72 for more.
   static func requiresZeroLengthWriteWorkaround(group: EventLoopGroup, hasTLS: Bool) -> Bool {
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
       if group is NIOTSEventLoopGroup || group is QoSEventLoop {
         // We need the zero-length write workaround on NIOTS when not using TLS.
         return !hasTLS
@@ -358,7 +358,7 @@ extension PlatformSupport {
     loopCount: Int
   ) -> EventLoopGroup {
     #if canImport(Network)
-    if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
+    if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) {
       if configuration.isNetworkFrameworkTLSBackend {
         return NIOTSEventLoopGroup(loopCount: loopCount)
       }
@@ -384,7 +384,7 @@ extension GRPCTLSConfiguration {
     switch networkPreference.implementation.wrapped {
     case .networkFramework:
       #if canImport(Network)
-      guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else {
+      guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else {
         // This is gated by the availability of `.networkFramework` so should never happen.
         fatalError(".networkFramework is being used on an unsupported platform")
       }

+ 2 - 2
Sources/GRPC/Server.swift

@@ -121,7 +121,7 @@ public final class Server: @unchecked Sendable {
 
     #if canImport(Network)
     if let tlsConfiguration = configuration.tlsConfiguration {
-      if #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *),
+      if #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *),
         let transportServicesBootstrap = bootstrap as? NIOTSListenerBootstrap
       {
         _ = transportServicesBootstrap.tlsOptions(from: tlsConfiguration)
@@ -172,7 +172,7 @@ public final class Server: @unchecked Sendable {
             hasTLS: configuration.tlsConfiguration != nil
           )
           if requiresZeroLengthWorkaround,
-            #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+            #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
           {
             try sync.addHandler(NIOFilterEmptyWritesHandler())
           }

+ 3 - 3
Tests/GRPCTests/FunctionalTests.swift

@@ -371,7 +371,7 @@ class FunctionalTestsMutualAuthentication: FunctionalTestsInsecureTransport {
 // Unfortunately `swift test --generate-linuxmain` uses the macOS test discovery. Because of this
 // it's difficult to avoid tests which run on Linux. To get around this shortcoming we can just
 // run no-op tests on Linux.
-@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
 class FunctionalTestsInsecureTransportNIOTS: FunctionalTestsInsecureTransport {
   override var networkPreference: NetworkPreference {
     #if canImport(Network)
@@ -457,7 +457,7 @@ class FunctionalTestsInsecureTransportNIOTS: FunctionalTestsInsecureTransport {
 }
 
 #if canImport(NIOSSL)
-@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
 class FunctionalTestsAnonymousClientNIOTS: FunctionalTestsInsecureTransportNIOTS {
   override var transportSecurity: TransportSecurity {
     return .anonymousClient
@@ -512,7 +512,7 @@ class FunctionalTestsAnonymousClientNIOTS: FunctionalTestsInsecureTransportNIOTS
   }
 }
 
-@available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
+@available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *)
 class FunctionalTestsMutualAuthenticationNIOTS: FunctionalTestsInsecureTransportNIOTS {
   override var transportSecurity: TransportSecurity {
     return .mutualAuthentication

+ 5 - 5
Tests/GRPCTests/ZeroLengthWriteTests.swift

@@ -134,7 +134,7 @@ final class ZeroLengthWriteTests: GRPCTestCase {
   ) {
     // We can only run this test on platforms where the zero-length write workaround _could_ be added.
     #if canImport(Network)
-    guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
+    guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
     let group = PlatformSupport.makeEventLoopGroup(
       loopCount: 1,
       networkPreference: networkPreference
@@ -171,7 +171,7 @@ final class ZeroLengthWriteTests: GRPCTestCase {
   func testZeroLengthWriteTestPosixSecure() throws {
     // We can only run this test on platforms where the zero-length write workaround _could_ be added.
     #if canImport(Network)
-    guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
+    guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
 
     let serverExpectation = self.noZeroLengthWriteExpectation()
     let clientExpectation = self.noZeroLengthWriteExpectation()
@@ -195,7 +195,7 @@ final class ZeroLengthWriteTests: GRPCTestCase {
   func testZeroLengthWriteTestPosixInsecure() throws {
     // We can only run this test on platforms where the zero-length write workaround _could_ be added.
     #if canImport(Network)
-    guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
+    guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
 
     let serverExpectation = self.noZeroLengthWriteExpectation()
     let clientExpectation = self.noZeroLengthWriteExpectation()
@@ -219,7 +219,7 @@ final class ZeroLengthWriteTests: GRPCTestCase {
   func testZeroLengthWriteTestNetworkFrameworkSecure() throws {
     // We can only run this test on platforms where the zero-length write workaround _could_ be added.
     #if canImport(Network)
-    guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
+    guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
 
     let serverExpectation = self.noZeroLengthWriteExpectation()
     let clientExpectation = self.noZeroLengthWriteExpectation()
@@ -243,7 +243,7 @@ final class ZeroLengthWriteTests: GRPCTestCase {
   func testZeroLengthWriteTestNetworkFrameworkInsecure() throws {
     // We can only run this test on platforms where the zero-length write workaround _could_ be added.
     #if canImport(Network)
-    guard #available(OSX 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
+    guard #available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 6.0, *) else { return }
 
     let serverExpectation = self.zeroLengthWriteExpectation()
     let clientExpectation = self.zeroLengthWriteExpectation()