Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
src/ | 23-Nov-2023 | - | 4,420 | 3,921 | ||
BUILD.bazel | D | 23-Nov-2023 | 316 | 13 | 12 | |
Dockerfile | D | 23-Nov-2023 | 746 | 21 | 15 | |
README.md | D | 23-Nov-2023 | 2 KiB | 62 | 51 | |
build.gradle | D | 23-Nov-2023 | 11.2 KiB | 331 | 304 | |
check-artifact.sh | D | 23-Nov-2023 | 3.7 KiB | 130 | 102 |
README.md
1gRPC Java Codegen Plugin for Protobuf Compiler 2============================================== 3 4This generates the Java interfaces out of the service definition from a 5`.proto` file. It works with the Protobuf Compiler (``protoc``). 6 7Normally you don't need to compile the codegen by yourself, since pre-compiled 8binaries for common platforms are available on Maven Central. However, if the 9pre-compiled binaries are not compatible with your system, you may want to 10build your own codegen. 11 12## System requirement 13 14* Linux, Mac OS X with Clang, or Windows with MSYS2 15* Java 7 or up 16* [Protobuf](https://github.com/google/protobuf) 3.0.0-beta-3 or up 17 18## Compiling and testing the codegen 19Change to the `compiler` directory: 20``` 21$ cd $GRPC_JAVA_ROOT/compiler 22``` 23 24To compile the plugin: 25``` 26$ ../gradlew java_pluginExecutable 27``` 28 29To test the plugin with the compiler: 30``` 31$ ../gradlew test 32``` 33You will see a `PASS` if the test succeeds. 34 35To compile a proto file and generate Java interfaces out of the service definitions: 36``` 37$ protoc --plugin=protoc-gen-grpc-java=build/exe/java_plugin/protoc-gen-grpc-java \ 38 --grpc-java_out="$OUTPUT_FILE" --proto_path="$DIR_OF_PROTO_FILE" "$PROTO_FILE" 39``` 40To generate Java interfaces with protobuf lite: 41``` 42$ protoc --plugin=protoc-gen-grpc-java=build/exe/java_plugin/protoc-gen-grpc-java \ 43 --grpc-java_out=lite:"$OUTPUT_FILE" --proto_path="$DIR_OF_PROTO_FILE" "$PROTO_FILE" 44``` 45To generate Java interfaces with protobuf nano: 46``` 47$ protoc --plugin=protoc-gen-grpc-java=build/exe/java_plugin/protoc-gen-grpc-java \ 48 --grpc-java_out=nano:"$OUTPUT_FILE" --proto_path="$DIR_OF_PROTO_FILE" "$PROTO_FILE" 49``` 50 51## Installing the codegen to Maven local repository 52This will compile a codegen and put it under your ``~/.m2/repository``. This 53will make it available to any build tool that pulls codegens from Maven 54repostiories. 55``` 56$ ../gradlew install 57``` 58 59## Creating a release of GRPC Java 60Please follow the instructions in ``RELEASING.md`` under the root directory for 61details on how to create a new release. 62