google / dagger

A fast dependency injector for Android and Java.
https://dagger.dev
Apache License 2.0
17.44k stars 2.02k forks source link

Dagger-gRPC doesn't work with gRPC-Kotlin #1978

Open Kernald opened 4 years ago

Kernald commented 4 years ago

I'm not exactly sure how this logic works, I'm not familiar with reflection and JavaPoet at all. But trying to use Dagger-gRPC with a server using gRPC-Kotlin, this condition check fails. This is the definition of my service:

@GrpcService(grpcClass = PaintKindServiceGrpcKt::class)
class PaintKindService @Inject constructor() :
  PaintKindServiceGrpcKt.PaintKindServiceCoroutineImplBase() { /* ... */ }

The codegen claims that PaintKindServiceGrpcKt is not a gRPC service class. I tried adding a dependency on the Java service base and passing this one (PaintKindServiceGrpc) to @GrpcService, but unsurprisingly the codegen then complains that PaintKindServiceGrpc and my PaintKindService implementation are unrelated - which I guess is fair enough, as far as I understand the Java and Kotlin implementations have a quite different way of getting instantiated.

Are there any plans to make Dagger-gRPC works with gRPC-Kotlin?

bubenheimer commented 3 years ago

This specific issue prohibits usage of dagger-grpc with grpc-kotlin from what I can tell. I question that the "P3" label is appropriate, which seems to suggest that the problem will not be addressed in the foreseeable future. grpc-kotlin is now released as stable 1.0.0. Can the dagger maintainers please consider supporting it in dagger-grpc?