Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make server codegen more deterministic by ensuring service methods ordering #988 #992

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/src/main/scala/akka/grpc/gen/javadsl/Service.scala
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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")
}
Original file line number Diff line number Diff line change
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