Skip to content

Commit

Permalink
Make server codegen more deterministic by ensuring service methods or…
Browse files Browse the repository at this point in the history
…dering #988
  • Loading branch information
charlietsai committed Jun 3, 2020
1 parent fec8123 commit d4bb438
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion codegen/src/main/scala/akka/grpc/gen/javadsl/Service.scala
Expand Up @@ -20,7 +20,7 @@ final case class Service(
serverPowerApi: Boolean,
usePlayActions: Boolean,
comment: Option[String] = None) {
def serializers: Set[Serializer] = (methods.map(_.deserializer) ++ methods.map(_.serializer)).toSet
def serializers: Seq[Serializer] = (methods.map(_.deserializer) ++ methods.map(_.serializer)).distinct
def packageDir = packageName.replace('.', '/')
}

Expand Down
Expand Up @@ -19,7 +19,7 @@ case class Service(
serverPowerApi: Boolean,
usePlayActions: Boolean,
comment: Option[String] = None) {
def serializers: Set[Serializer] = (methods.map(_.deserializer) ++ methods.map(_.serializer)).toSet
def serializers: Seq[Serializer] = (methods.map(_.deserializer) ++ methods.map(_.serializer)).distinct
def packageDir = packageName.replace('.', '/')
}

Expand Down
Expand Up @@ -12,5 +12,5 @@
case akka.grpc.gen.ClientStreaming => singleResponse
case akka.grpc.gen.ServerStreaming => streamResponse
case akka.grpc.gen.BidiStreaming => streamResponse
}.toSet.mkString("\n")
}.distinct.mkString("\n")
}
Expand Up @@ -24,7 +24,7 @@ import akka.grpc.internal.ClientState
@{
def withSingleResponse(stmt: String) = Set("import akka.grpc.scaladsl.SingleResponseRequestBuilder", stmt)
def withStreamResponse(stmt: String) = Set("import akka.grpc.scaladsl.StreamResponseRequestBuilder", stmt)
service.methods.toSet.flatMap { method: akka.grpc.gen.scaladsl.Method =>
service.methods.distinct.flatMap { method: akka.grpc.gen.scaladsl.Method =>

val statements = method.methodType match {
case akka.grpc.gen.Unary => withSingleResponse("import akka.grpc.internal.ScalaUnaryRequestBuilder")
Expand Down

0 comments on commit d4bb438

Please sign in to comment.