The code generated by the wire-grpc-server calls ServiceDescriptor.setSchemaDescriptor with a lambda converted to a io.grpc.protobuf.ProtoFileDescriptorSupplier:
|
builder.addStatement( |
|
""" |
|
.setSchemaDescriptor(io.grpc.protobuf.ProtoFileDescriptorSupplier { |
|
fileDescriptor("${protoFile.location.path}", emptySet()) |
|
}) |
|
""".trimIndent(), |
Unfortunately ProtoFileDescriptorSupplier is defined in Google's grpc-protobuf package, which brings in all sorts of unwanted dependencies, in particular com.google.api.grpc:proto-google-common-protos which pulls in protoc-generated versions of Google common types. Using ProtoFileDescriptorSupplier is necessary if you want to use Wire with Google's ProtoReflectionServiceV1 from grpc-services, but isn't otherwise. In our application we've written our own reflection implementation to avoid this dependency.
Would the maintainers accept a PR that added an option to specify the class used for the service descriptor callback? io.grpc.protobuf.ProtoFileDescriptorSupplier would be the default, but it could be set to a different type, or left blank to generate a regular Kotlin lambda (() -> Descriptors.FileDescriptor).
The code generated by the wire-grpc-server calls
ServiceDescriptor.setSchemaDescriptorwith a lambda converted to aio.grpc.protobuf.ProtoFileDescriptorSupplier:wire-grpc-server/server-generator/src/main/java/com/squareup/wire/kotlin/grpcserver/ServiceDescriptorGenerator.kt
Lines 90 to 95 in 864a420
Unfortunately
ProtoFileDescriptorSupplieris defined in Google'sgrpc-protobufpackage, which brings in all sorts of unwanted dependencies, in particularcom.google.api.grpc:proto-google-common-protoswhich pulls inprotoc-generated versions of Google common types. UsingProtoFileDescriptorSupplieris necessary if you want to use Wire with Google'sProtoReflectionServiceV1fromgrpc-services, but isn't otherwise. In our application we've written our own reflection implementation to avoid this dependency.Would the maintainers accept a PR that added an option to specify the class used for the service descriptor callback?
io.grpc.protobuf.ProtoFileDescriptorSupplierwould be the default, but it could be set to a different type, or left blank to generate a regular Kotlin lambda (() -> Descriptors.FileDescriptor).