Browse Source

Use forward looking SwiftProtobuf API (#1482)

George Barnett 3 years ago
parent
commit
58ea6392e1

+ 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,