Skip to content
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 DSL builder for protobuf messages #171

Open
ks-yim opened this issue Nov 14, 2023 · 3 comments
Open

Generate Kotlin DSL builder for protobuf messages #171

ks-yim opened this issue Nov 14, 2023 · 3 comments

Comments

@ks-yim
Copy link
Contributor

ks-yim commented Nov 14, 2023

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 {}
    }
}
@ikhoon
Copy link
Contributor

ikhoon commented Nov 15, 2023

It sounds like a good idea.

@ks-yim
Copy link
Contributor Author

ks-yim commented Nov 15, 2023

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 ~ 😆

@ikhoon
Copy link
Contributor

ikhoon commented Nov 28, 2023

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? 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants