Skip to content

How can I generate Kotlin code instead of Java code ? #132

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
aalexsanyan opened this issue Jun 28, 2020 · 2 comments
Closed

How can I generate Kotlin code instead of Java code ? #132

aalexsanyan opened this issue Jun 28, 2020 · 2 comments

Comments

@aalexsanyan
Copy link

I am new to Protobuf and the project I am working on is using Protobuf and it is generating to java.
Now I want to change it to Kotlin .
Would you mind to help to change it ,so I can make it generate Kotlin code

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.0.0'
    }
    plugins {
        javalite {
            artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
        }
    }
}

dependencies {
    api('com.google.protobuf:protobuf-lite:3.0.1')
}
`
@jamesward
Copy link
Collaborator

grpc-kotlin will still generate the Java but it will also generate idiomatic Kotlin wrappers around it. Here is an example Gradle build:
https://github.com/grpc/grpc-kotlin/blob/master/examples/build.gradle

@chalin
Copy link
Contributor

chalin commented Jun 30, 2020

Not sure, but is this a duplicate of #64? If so, from the README:

Note: The Kotlin protoc plugin uses the [Java protoc plugin][gen-java]
behind the scenes to generate message types as Java classes.
Generation of Kotlin sources for proto messages is being discussed in
protocolbuffers/protobuf#3742.

cc @lowasser

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

No branches or pull requests

4 participants