zhangkun83 | d54a463 | 2015-01-26 10:53:17 -0800 | [diff] [blame] | 1 | gRPC Java Plugin for Protobuf Compiler |
| 2 | ============================================== |
| 3 | |
| 4 | This generates the Java interfaces out of the service definition from a `.proto` file. |
| 5 | |
| 6 | ## System Requirement |
| 7 | |
| 8 | * Linux |
| 9 | * The Github head of [Protobuf](https://github.com/google/protobuf) installed |
| 10 | * [Gradle](https://www.gradle.org/downloads) installed |
| 11 | |
| 12 | ## Compiling and Testing the Plugin |
| 13 | Change to the `compiler` directory: |
| 14 | ``` |
| 15 | $ cd $GRPC_JAVA_ROOT/compiler |
| 16 | ``` |
| 17 | |
| 18 | To compile the plugin: |
| 19 | ``` |
| 20 | $ gradle java_pluginExecutable |
| 21 | ``` |
| 22 | |
| 23 | To test the plugin with the compiler: |
| 24 | ``` |
| 25 | $ gradle test |
| 26 | ``` |
| 27 | You will see a `PASS` if the test succeeds. |
| 28 | |
| 29 | To compile a proto file and generate Java interfaces out of the service definitions: |
| 30 | ``` |
| 31 | $ protoc --plugin=protoc-gen-java_rpc=build/binaries/java_pluginExecutable/java_plugin \ |
| 32 | --java_rpc_out="$OUTPUT_FILE" --proto_path="$DIR_OF_PROTO_FILE" "$PROTO_FILE" |
| 33 | ``` |