-
Notifications
You must be signed in to change notification settings - Fork 278
Feature Request: support Java protoc plugins and allow specifying main class #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The hardest part of this seems to be "support Java protoc plugins." After that, it seems it would be easy to provide a way to override the mainClass (I assume because the JAR did not set one in its metadata). It does seem that the plugin would have to generate a .sh or .bat file to be executed by protoc. |
mainClass
et al for protocPlugin
So, if I don't find a I am not yet sure if |
Yeah, it might not; it may require calling cmd.exe, which would defeat the purpose. The Maven protoc plugin logic seems sane; mimicking it would be reasonable. |
FWIW, the "specify main method" thing isn't actually important to me, I realized the jar is actually executable already. Main thing is to just support .jar plugins. My current workaround:
|
From https://github.com/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/ToolsLocator.groovy#L84, it looks to me that all that's needed is for some way to override the |
@zhangkun83 , I'd like to implement the above PR. One issue is that if we stick with the Gradle syntax described in https://docs.gradle.org/3.3/userguide/dependency_management.html#sub:classifiers, it would break backwards compatibility since existing users will have to start specifying explicitly the One alternative is to create some other syntax (perhaps a field indicating the classifier and extension). My personal preference would be to break backwards compatibility now while the version of the plugin is |
Actually, I see a way to maintain backwards compatibility -- developers of the codegen plugin publish with a |
If you're looking at a somewhat complete example, you might wish to have a look here: https://github.com/Xorlev/grpc-jersey/blob/master/build.gradle |
We have an existing codegen plugin for protobuf that is invoked in a maven build thusly:
If I try to add this same plugin the way this project specifies that plugins should be added:
The build fails (target
protobufToolsLocator_foo
) because it's trying to download an executable artifactfoo-protobuf-plugin-osx-x86_64.exe
which doesn't exist (the artifact is actuallyfoo-protobuf-plugin-HEAD-SNAPSHOT.jar
).I think I can work around this by creating a local executable that downloads the jar and runs it with the classname specified, but it would be rad if this library included this functionality.
The text was updated successfully, but these errors were encountered: