-
Notifications
You must be signed in to change notification settings - Fork 24
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
Specify directory or list of files as a dependency #7
Comments
For anyone that stumbles upon this issue. A suboptimal workaround that I'm using at the moment is as follows: depedencies {
protobuf files("$buildDir/distributions/some_project_pb.zip")
}
task protobufZip(type: Zip) {
archiveName = 'some_project_pb.zip'
from "$projectDir/deps/some_project/src"
include '**/*.proto'
}
extractProto.dependsOn protobufZip Essentially the above code introduces a task that runs before the This code moves backwards to go forwards... by zipping up code so that it can then be unzipped by this plugin. If I get some time I'll work on submitting a pull request for this issue but I'm not likely to have time at all soon. |
Why not just put the files into your ${projectDir}/src/main/proto directory? The plugin will take all the *.proto files from there and run protoc against them. |
Well, let's say that I'm including (for example) this project as a submodule in my Git project: https://github.com/basho/riak_pb That project has three Protobuf definition files (at the moment, this could change at any moment...): dependencies {
protobuf files('deps/riak_pb/src/riak.proto', 'deps/riak_pb/src/riak_kv.proto')
} At the moment I'm actually using a modified version of the Zip task I pasted above to zip only the two files. |
Essentially what I'm hoping for is the inclusion of more fine-grained control over which Protobuf definition files are compiled to Java code without the need to Zip and Unzip a collection of Let me know if the use case (motivation) for this feature request needs more discussion. Cheers. |
Chris, I've taken a stab at implementing the functionality you've described. Please let me know if this is how you wanted it to work. Thanks, |
Hey Alex, Thanks for the feature enhancement, that works for me! Cheers, Chris |
Hi Alex, This is a very useful update. Can you please upload the jar to Maven Central as well? Also, is there any plan to support wildcards (like *.proto) in the files definition? Thank You, Tin |
Hello Tin, I am working on cutting the final release of the new version sometime by the end of this month. (Want to make sure that Issue 8 gets resolved). As for the wildcards, you can use any standard Gradle FileCollection generating function (such as files, fileTree, etc), so you should be able to use http://www.gradle.org/docs/current/javadoc/org/gradle/api/Project.html#fileTree(java.util.Map) with something like this: protobuf fileTree(dir: 'protos', include: '*.proto') |
Thank you very much for the detailed response, Alex. I tried and it works for me now. Looking forward to your next release :-).. |
Is it possible to specify
fileTree(...)
orfiles(...)
to list dependencies?Something like this:
The text was updated successfully, but these errors were encountered: