gradle-scripts
gradle-scripts copied to clipboard
Generate Kotlin DSL builder for protobuf messages
Motivation:
Currently, java-rpc-proto.gradle does not generate Kotlin DSL builder
for protobuf messages even when the project is flagged with kotlin-grpc.
Registering kotlin plugin within generateProtoTasks closure will make it
generate Kotlin DSL builder for protobuf mesages.
generateProtoTasks {
if (project.ext.hasFlag('kotlin-grpc') && ...) {
kotlinGrpc {}
// Apply `kotlin` plugin to generate DSL builder.
kotlin {}
}
}
It sounds like a good idea.
Did some tests, and the right way to add kotlin plugin would be the following.
The original approach emits a warning.
generateProtoTasks {
all().forEach { it ->
it.plugins {
kotlinGrpc {}
}
it.builtins {
kotlin {}
}
}
}
I will send a PR ~ 😆
Unfortunately, there are no tests in this repo. Would you send a PR to Armeria first so that we easily check if the option correctly generates Kotlin DSL in the PR review? 😉