higherkindness / mu-scala

Mu is a purely functional library for building RPC endpoint based services with support for RPC and HTTP/2
Apache License 2.0
333 stars 37 forks source link

Extraneous imports #637

Closed ArulselvanMadhavan closed 4 years ago

ArulselvanMadhavan commented 5 years ago

Hello!

Thanks for making this library. I'm trying to use this at work but ran into a few problems.

I have a proto file that looks like this:

syntax = "proto3";

package com.chartboost.adserver.common.model.grpc;

message HelloRequest {
  string name = 1;
}

message HelloResponse {
  string message = 1;
}

service Greeter {
  rpc SayHello (HelloRequest) returns (HelloResponse);
}

When I run srcGen it generates the following code.

package com.chartboost.adserver.common.model.grpc
import higherkindness.mu.rpc.protocol._
import fs2.Stream
import shapeless.{:+:, CNil}

object Greeter { 

@message final case class HelloRequest(name: String)
@message final case class HelloResponse(message: String)
@service(Protobuf, Identity) trait Greeter[F[_]] {
  def SayHello(req: HelloRequest): F[HelloResponse]
}

}
  1. Why do we have fs2 and shapeless imports eventhough they are not used in the generated file? It forces me to add mu-rpc-fs2 as a dependency even though I'm not using streaming rpc.
  2. It also leads to unused imports errors forcing me to turn off the compiler flag that checks for unused imports.

It'd be great if someone can explain why we have fs2 and shapeless imports, even though they are not used in the generated code.

Thanks

fedefernandez commented 5 years ago

@ArulselvanMadhavan thanks, proto generation needs some improvements that we're capturing and we'll address them very soon.