diff --git a/codegen-sbt/src/main/scala/caliban/codegen/CompileTimeCalibanPlugin.scala b/codegen-sbt/src/main/scala/caliban/codegen/CompileTimeCalibanPlugin.scala index d06f421549..f9c629ea62 100644 --- a/codegen-sbt/src/main/scala/caliban/codegen/CompileTimeCalibanPlugin.scala +++ b/codegen-sbt/src/main/scala/caliban/codegen/CompileTimeCalibanPlugin.scala @@ -82,16 +82,16 @@ object CompileTimeCalibanServerPlugin extends AutoPlugin { | |import caliban.tools.compiletime.CompileTime |import caliban.tools.compiletime.Config.ClientGenerationSettings - |import zio.{ExitCode, URIO} | |private[generator] object $generatorName { - | def main(args: Array[String]): Unit = - | zio.Runtime.default.unsafeRun( + | def main(args: Array[String]): Unit = { + | val _ = zio.Runtime.default.unsafeRun( | CompileTime.generateClient(args.toList)( | $ref, | ${clientSettings.asScalaCode} | ) | ) + | } |} |""".stripMargin.trim diff --git a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/build.sbt b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/build.sbt index ed6205b677..fcc157541b 100644 --- a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/build.sbt +++ b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/build.sbt @@ -4,12 +4,13 @@ import sbt.librarymanagement.Resolver Global / onChangedBuildSource := ReloadOnSourceChanges ThisBuild / organization := "Conduktor" -ThisBuild / homepage := Some(url("https://www.conduktor.io/")) -ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) -ThisBuild / version := "0.0.1" +ThisBuild / homepage := Some(url("https://www.conduktor.io/")) +ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) +ThisBuild / version := "0.0.1" ThisBuild / scalaVersion := "2.12.14" // Must stay 2.12 in these tests because the plugin is compiled with 2.12 ThisBuild / resolvers += Resolver.mavenLocal ThisBuild / resolvers += Resolver.sonatypeRepo("snapshots") +ThisBuild / scalacOptions ++= Seq("-Xfatal-warnings", "-feature") // ### Dependencies ### @@ -54,7 +55,7 @@ lazy val root = preserveExecutable = args(2).toBoolean ) }, - InputKey[Unit]("sed-in-place") := { + InputKey[Unit]("sed-in-place") := { val args: Vector[String] = spaceDelimited("").parsed.toVector val previousValue = args(0) @@ -120,7 +121,7 @@ lazy val postsClients = .in(file("modules/posts-clients")) .enablePlugins(CompileTimeCalibanClientPlugin) .settings( - Compile / ctCalibanClient / ctCalibanClientsSettings := Seq(posts), + Compile / ctCalibanClient / ctCalibanClientsSettings := Seq(posts), Compile / ctCalibanClient / ctCalibanClientsVersionedCode := false ) diff --git a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/posts/src/main/scala/poc/caliban/posts/GraphQLApi.scala b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/posts/src/main/scala/poc/caliban/posts/GraphQLApi.scala index 5d60e0aaa9..a471689426 100644 --- a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/posts/src/main/scala/poc/caliban/posts/GraphQLApi.scala +++ b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/posts/src/main/scala/poc/caliban/posts/GraphQLApi.scala @@ -8,6 +8,8 @@ import zio._ import zio.duration.durationInt import zio.stream.ZStream +import scala.language.higherKinds + object Operations { final case class CreatePostMutationParams(authorName: AuthorName, title: PostTitle, content: PostContent) diff --git a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/potatoes/src/main/scala/poc/caliban/potatoes/PotatoesApi.scala b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/potatoes/src/main/scala/poc/caliban/potatoes/PotatoesApi.scala index d456e69956..4b26dfa18b 100644 --- a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/potatoes/src/main/scala/poc/caliban/potatoes/PotatoesApi.scala +++ b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/modules/potatoes/src/main/scala/poc/caliban/potatoes/PotatoesApi.scala @@ -8,6 +8,8 @@ import zio._ import zio.duration.durationInt import zio.stream.ZStream +import scala.language.higherKinds + object Operations { final case class MakeNewSpeciesMutationParams(name: Potato.Name, color: Potato.Color) diff --git a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/test b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/test index 27c2896c50..e063c05659 100644 --- a/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/test +++ b/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/test @@ -1,3 +1,7 @@ +# 0. Reset/clean project + +> clean + # 1. Test code generation # ## From the 'posts' "default" config $ absent modules/posts-clients/target/scala-2.12/src_managed/main/generated/Client.scala