Skip to content

Commit 19bd5c6

Browse files
authored
Merge pull request #323 from grpc/plugin-and-docs
Improve the documentation on building the `protoc` plugins and add a `make plugin` option.
2 parents 5ee9e87 + 48c274f commit 19bd5c6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ all:
99
swift build $(CFLAGS)
1010
cp .build/debug/protoc-gen-swift .
1111
cp .build/debug/protoc-gen-swiftgrpc .
12-
12+
13+
plugin:
14+
swift build $(CFLAGS) --product protoc-gen-swift -c release -Xswiftc -static-stdlib
15+
swift build $(CFLAGS) --product protoc-gen-swiftgrpc -c release -Xswiftc -static-stdlib
16+
cp .build/release/protoc-gen-swift .
17+
cp .build/release/protoc-gen-swiftgrpc .
18+
1319
project:
1420
swift package $(CFLAGS) generate-xcodeproj --output SwiftGRPC.xcodeproj
1521
@-ruby fix-project-settings.rb SwiftGRPC.xcodeproj || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,17 @@ generate the necessary support code.
7171
Binary releases of `protoc`, the Protocol Buffer Compiler, are
7272
available on [GitHub](https://github.com/google/protobuf/releases).
7373

74-
To build the plugins, run `make` in the main directory.
74+
To build the plugins, run `make plugin` in the main directory.
7575
This uses the Swift Package Manager to build both of the necessary
7676
plugins: `protoc-gen-swift`, which generates Protocol Buffer support code
7777
and `protoc-gen-swiftgrpc`, which generates gRPC interface code.
7878

79+
To install these plugins, just copy the two executables (`protoc-gen-swift` and `protoc-gen-swiftgrpc`) that show up in the main directory into a directory that is part of your `PATH` environment variable.
80+
7981
### Using the plugins
8082

8183
To use the plugins, `protoc` and both plugins should be in your
82-
search path. Invoke them with commands like the following:
84+
search path (see above). Invoke them with commands like the following:
8385

8486
protoc <your proto files> \
8587
--swift_out=. \

0 commit comments

Comments
 (0)