This is what I tried so far:
protobuf {
protoc { artifact = "com.google.protobuf:protoc:$protobufVersion" }
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" //
CURRENT_GRPC_VERSION
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
grpc { }
}
}
}
}
But the script doesn't generate the protobuf files, it only generates the
grpc files.
On Wednesday, 9 October 2019 09:22:44 UTC+1, Carlos Pages wrote:
>
> Hi,
>
> related: https://github.com/google/protobuf-gradle-plugin/issues/276
>
> ( I'm not an Android expert so I apologize in advance for any mistake )
>
> I know the recommendation is to use protobuf-lite but I need to convert my
> protobuf object to JSON, so I decided to use protobuf-java instead, and
> having access to the JsonFormat (
> https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/JsonFormat
> ),
> if it's posible.
>
> Could you guide me how to set it up in gradle.
>
> I added the dependency
>
> dependencies {
>
> ...
>
> implementation 'com.google.protobuf:protobuf-java:3.9.2'
>
>
>
>
> But I'm having a bit more of trouble set it up the protobuf script:
>
> protobuf {
> protoc { artifact = 'com.google.protobuf:protoc:3.6.1' }
> plugins {
> javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
> }
> grpc {
> artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" //
> CURRENT_GRPC_VERSION
> }
> }
> generateProtoTasks {
> all().each { task ->
> task.plugins {
> javalite {}
> grpc { // Options added to --grpc_out
> option 'lite'
> }
> }
> }
> }
> }
>
>
> How can I convert it to use protobuf-java instead.
>
> I tried to replace the lite library for java, but with no success.
>
> If you could point me to any documentation to manage the protobuf script
> in gradle, it would be very useful.
>
> Thanks
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/14e8acdf-ee52-4f47-971a-5206fdc26fc5%40googlegroups.com.