forked from sergei-ivanov/maven-protoc-plugin
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow for custom plugins to be supplied to the main invocation of pro…
…toc. The protobuf plugin does not allow for custom plugins to be supplied to a single protoc that includes the main java stub generation. This ends up being a problem for plugins that utilize features like protobuf's extension point support, since they rely on protoc to supply info about where it's main phase has emitted Java code. Instead of relying on the compile-custom goal to execute a new, distinct follow-on execution of protoc, allow for <plugin> elements in the configuration of the main compile task to augment the arguments passed to protoc. For example, after this commit, you can do the following <plugin> <groupId>org.xolstice.maven.plugins</groupId> <artifactId>protobuf-maven-plugin</artifactId> <version>0.7.0-SNAPSHOT</version> <configuration> <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact> <protocPlugins> <plugin> <id>grpc-java</id> <groupId>io.grpc</groupId> <artifactId>protoc-gen-grpc-java</artifactId> <version>${grpc.version}</version> <type>exe</type> <classifier>${os.detected.classifier}</classifier> </plugin> <plugin> <id>kotlin</id> <groupId>com.github.marcoferrer.krotoplus</groupId> <artifactId>protoc-gen-kroto-plus</artifactId> <version>${kroto-plus.version}</version> <classifier>jvm8</classifier> </plugin> </protocPlugins> </configuration> <executions> <execution><goals><goal>compile</goal></goals></execution> </executions> </plugin> With the above configuration, maven generates and executes a command line that looks like protoc --java_out=... --plugin=protoc-gen-grpc-java --grpc-java_out=... --plugin=protoc-gen-kroto-plus --kroto-plus_out=... which allows for plugins to have full access to the entire protoc generation context.
- Loading branch information
Showing
5 changed files
with
148 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.