From c8394bd370e5a1324ba52f75b1a16b113c12bba1 Mon Sep 17 00:00:00 2001 From: Andy Chou Date: Wed, 22 Mar 2017 19:57:19 -0700 Subject: [PATCH 1/2] Explicitly specify protoc plugin in Plugin test target This change explicitly specifies the swift grpc ptotoc plugin in the `Plugin` directory, so users without `.` in the path can run the test target. Also add some build artifacts from the Plugin directory to .gitignore. --- .gitignore | 2 ++ Plugin/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 062ffd4ef..e318e1bbe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ project.xcworkspace xcuserdata .build third_party/** +Plugin/Packages/** +Plugin/protoc-* diff --git a/Plugin/Makefile b/Plugin/Makefile index 7186b5bec..bd5c49c3e 100644 --- a/Plugin/Makefile +++ b/Plugin/Makefile @@ -9,7 +9,7 @@ build: clear cp .build/debug/protoc-gen-swift . test: build - protoc ../Examples/Echo/echo.proto --proto_path=../Examples/Echo --swiftgrpc_out=. + protoc ../Examples/Echo/echo.proto --proto_path=../Examples/Echo --plugin=./protoc-gen-swiftgrpc --swiftgrpc_out=. diff echo.client.pb.swift ../Examples/Echo/Generated/echo.client.pb.swift diff echo.server.pb.swift ../Examples/Echo/Generated/echo.server.pb.swift From 37922f1ae7cdfa1c2f32ad66a94be4426d9c739d Mon Sep 17 00:00:00 2001 From: Andy Chou Date: Wed, 22 Mar 2017 20:17:48 -0700 Subject: [PATCH 2/2] Add rudimentary installation instructions to plugin Describe how `protoc` finds the plugin binary in the path. A simple installation can be performed by copying the binary to a directory in the path. Also fix the example `protoc` invocation to match the Makefile by adding an explicit `--plugin` argument. Also add a few more files to .gitignore that are generated during plugin build/test. --- .gitignore | 2 ++ Plugin/README.md | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e318e1bbe..60196249e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ xcuserdata third_party/** Plugin/Packages/** Plugin/protoc-* +Plugin/swiftgrpc.log +Plugin/echo.*.swift diff --git a/Plugin/README.md b/Plugin/README.md index 771bc4a5d..28847f7de 100644 --- a/Plugin/README.md +++ b/Plugin/README.md @@ -6,11 +6,15 @@ the Protocol Buffer Compiler. It is built with the Swift Package Manager and the included Makefile. The resulting binary is named `protoc-gen-swiftgrpc` and can be called from `protoc` by adding the `--swiftgrpc_out` -command-line option. For example, here's an invocation from -the Makefile: +command-line option and `--plugin` option. For example, here's an +invocation from the Makefile: - protoc ../Examples/Echo/echo.proto --proto_path=../Examples/Echo --swiftgrpc_out=. + protoc ../Examples/Echo/echo.proto --proto_path=../Examples/Echo --plugin=./protoc-gen-swiftgrpc --swiftgrpc_out=. The plugin uses template files in the [Templates](Templates) directory. These files are compiled into the `protoc-gen-swiftgrpc` plugin executable. +The Swift gRPC plugin can be installed by placing the +`protoc-gen-swiftgrpc` binary into one of the directories in your +path. Specifying `--swiftgrpc_out` to `protoc` will automatically +search the `PATH` environment variable for this binary.