Procházet zdrojové kódy

Use forward looking SwiftProtobuf API (#1482)

George Barnett před 3 roky
rodič
revize
7fcc7bcef1

+ 1 - 1
Package.swift

@@ -48,7 +48,7 @@ let packageDependencies: [Package.Dependency] = [
   ),
   .package(
     url: "https://github.com/apple/swift-protobuf.git",
-    from: "1.20.1"
+    from: "1.20.2"
   ),
   .package(
     url: "https://github.com/apple/swift-log.git",

+ 1 - 1
Package@swift-5.5.swift

@@ -49,7 +49,7 @@ let packageDependencies: [Package.Dependency] = [
   .package(
     name: "SwiftProtobuf",
     url: "https://github.com/apple/swift-protobuf.git",
-    from: "1.19.0"
+    from: "1.20.2"
   ),
   .package(
     url: "https://github.com/apple/swift-log.git",

+ 3 - 3
Sources/protoc-gen-grpc-swift/StreamingType.swift

@@ -38,14 +38,14 @@ extension StreamingType {
 }
 
 internal func streamingType(_ method: MethodDescriptor) -> StreamingType {
-  if method.proto.clientStreaming {
-    if method.proto.serverStreaming {
+  if method.clientStreaming {
+    if method.serverStreaming {
       return .bidirectionalStreaming
     } else {
       return .clientStreaming
     }
   } else {
-    if method.proto.serverStreaming {
+    if method.serverStreaming {
       return .serverStreaming
     } else {
       return .unary

+ 2 - 2
Sources/protoc-gen-grpc-swift/main.swift

@@ -125,8 +125,8 @@ func main() throws {
 
   // Only generate output for services.
   for name in request.fileToGenerate {
-    let fileDescriptor = descriptorSet.lookupFileDescriptor(protoName: name)
-    if !fileDescriptor.services.isEmpty {
+    if let fileDescriptor = descriptorSet.fileDescriptor(named: name),
+       !fileDescriptor.services.isEmpty {
       let grpcFileName = uniqueOutputFileName(
         component: "grpc",
         fileDescriptor: fileDescriptor,