@@ -8,20 +8,11 @@ If you've used Protocol Buffers before then generating gRPC Swift stubs should b
88unfamiliar with Protocol Buffers then you should get comfortable with the concepts before
99continuing; the [ Protocol Buffers website] ( https://protobuf.dev/ ) is a great place to start.
1010
11- The [ ` grpc-swift-protobuf ` ] ( https://github.com/grpc/grpc-swift-protobuf ) package provides
12- ` protoc-gen-grpc-swift ` , a program which is a plugin for the Protocol Buffers compiler, ` protoc ` .
13-
1411You can use the protoc plugin from the command line directly, or you can make use of a
1512 [ Swift Package Manager build plugin] ( https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/Plugins.md )
1613convenience which adds the stub generation to the Swift build graph.
1714You may use the build plugin either from the command line or from Xcode.
1815
19-
20- > ` protoc-gen-grpc-swift ` only generates gRPC stubs, it doesn't generate messages. You must use
21- > ` protoc-gen-swift ` to generate messages in addition to gRPC Stubs.
22-
23-
24-
2516## Using the build plugin
2617
2718The build plugin (` GRPCProtobufGenerator ` ) is a great choice for convenient dynamic code generation, however it does come with some limitations.
@@ -104,13 +95,18 @@ lower in the file hierarchy supersedes one above it.
10495
10596### Using protoc
10697
98+ The [ ` grpc-swift-protobuf ` ] ( https://github.com/grpc/grpc-swift-protobuf ) package provides
99+ ` protoc-gen-grpc-swift ` , a program which is a plugin for the Protocol Buffers compiler, ` protoc ` .
107100To generate gRPC stubs for your ` .proto ` files directly you must run the ` protoc ` command with
108101the ` --grpc-swift_out=<DIRECTORY> ` option:
109102
110103``` console
111104protoc --grpc-swift_out=. my-service.proto
112105```
113106
107+ > ` protoc-gen-grpc-swift ` only generates gRPC stubs, it doesn't generate messages. You must use
108+ > ` protoc-gen-swift ` to generate messages in addition to gRPC Stubs.
109+
114110The presence of ` --grpc-swift_out ` tells ` protoc ` to use the ` protoc-gen-grpc-swift ` plugin. By
115111default it'll look for the plugin in your ` PATH ` . You can also specify the path to the plugin
116112explicitly:
0 commit comments