Skip to content

Commit

Permalink
Fix compilation of projects using the ConpileTimeCaliban sbt plugin a…
Browse files Browse the repository at this point in the history
…nd the scalac `-Werror` flag
  • Loading branch information
guizmaii committed Jan 10, 2022
1 parent bdab36a commit 4dd27cc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###

Expand Down Expand Up @@ -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("<arg>").parsed.toVector

val previousValue = args(0)
Expand Down Expand Up @@ -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
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 4dd27cc

Please sign in to comment.