-
Notifications
You must be signed in to change notification settings - Fork 166
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
Generate Kotlin builders for external types #373
Comments
I believe that you can have dependencies on libraries that contain protos and the wrappers (Kotlin Protos for example) will be created around them. So I think this should work. Maybe I can build a little sample for this if I get the chance. |
Yeah, a sample should be great 😄 Thank you @jamesward! |
Here is the sample: Date Kotlin Builders part: The trick is to add a dep to the
That causes the protobuf Gradle plugin to treat it as a proto dependency and generate the sources for protos in the jar. Details: There is probably another way you could configure the Gradle plugin to only generate the Kotlin wrappers for that dependency (and not re-generate the Java wrappers that are already in the jar). Hopefully that helps! |
@jamesward I think I have the problem in that I have an intermediate // protos/build.gradle.kts
// it is using google protos
plugins {
`java-library`
}
java {
sourceSets.getByName("main").resources.srcDir("src/main/proto")
} And in the server // server/build.gradle.kts
dependencies {
protobuf(project(projects.protos.dependencyProject.path))
}
|
Check out how we do this in the grpc-kotlin examples: https://github.com/grpc/grpc-kotlin/tree/master/examples protos module: primary stub module: Let me know if that helps. |
Indeed I copied that setup, I will review it again to check if I am missing anything 🤔. |
The structure overview is something like:
|
The one part that might be hard to setup is a dependency in |
@jamesward but |
I have it setup so that |
I am using
date.proto
from Google types but I need to useDate.newBuilder()...
. Is it possible to generate adate { }
builder?The text was updated successfully, but these errors were encountered: