Skip to content

Commit

Permalink
Use forward looking SwiftProtobuf API (grpc#1482)
Browse files Browse the repository at this point in the history
  • Loading branch information
glbrntt authored and WendellXY committed Aug 24, 2023
1 parent 6ad7c0b commit c84b6d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion Package@swift-5.5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions Sources/protoc-gen-grpc-swift/StreamingType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/protoc-gen-grpc-swift/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c84b6d2

Please sign in to comment.