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 source for .proto messages? #64

Closed
charbgr opened this issue Apr 17, 2020 · 6 comments
Closed

Generate Kotlin source for .proto messages? #64

charbgr opened this issue Apr 17, 2020 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@charbgr
Copy link

charbgr commented Apr 17, 2020

Is there a way to generate Kotlin files from a proto3 message? Like Java's protoc but for Kotlin files?

@chalin chalin changed the title Generate Kotlin files Generate Kotlin source from .proto files Apr 17, 2020
@chalin chalin self-assigned this Apr 17, 2020
@chalin chalin added the question Further information is requested label Apr 17, 2020
@chalin
Copy link
Contributor

chalin commented Apr 17, 2020

Once your gradle file is setup (for example, see examples/build.gradle), then protoc will generate Kotlin sources from .proto files as part of the build.

If you build the Hello World example, the Kotlin source generated from

  • examples/src/main/proto/hello_world.proto

will end up in

  • examples/build/generated/source/proto/main/grpckt/io/grpc/examples/helloworld/HelloWorldGrpcKt.kt:

@pavlospt
Copy link

pavlospt commented Apr 17, 2020

@chalin I think what @charbgr meant, is if we are going to see in the near future, generation of .proto messages in Kotlin. Right now the gRPC Service stub is generated in Kotlin but the used messages are generated in Java.

@chalin chalin assigned lowasser and unassigned chalin Apr 17, 2020
@chalin chalin changed the title Generate Kotlin source from .proto files Generate Kotlin source for .proto messages? Apr 17, 2020
@chalin
Copy link
Contributor

chalin commented Apr 17, 2020

Oh right -- so you really did mean to ask about messages in your original question. I'll let @lowasser answer in that case.

@lowasser
Copy link
Collaborator

We are deliberately separating the choice of Kotlin APIs for gRPC and the choice of Kotlin APIs for protobuf, as projects may choose to use one but not the other.

Support for Kotlin protos is being discussed in protocolbuffers/protobuf#3742.

@chalin
Copy link
Contributor

chalin commented Apr 17, 2020

Given that this is being discussed elsewhere, can we close this issue?

@chalin
Copy link
Contributor

chalin commented Apr 21, 2020

Support for Kotlin protos is being discussed in protocolbuffers/protobuf#3742.

FYI, we've added a note to the README about this (#70).

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

No branches or pull requests

4 participants