forked from guardrail-dev/guardrail-sample-sbt-http4s-zio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
56 lines (44 loc) · 2.05 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name := "guardrail-sample-http4s-zio"
ThisBuild / organization := "se.hardchee"
ThisBuild / scalaVersion := "2.13.6"
// Convenience for cross-compat testing
ThisBuild / crossScalaVersions := Seq("2.12.14", "2.13.6")
val commonDependencies = Seq(
// Depend on http4s-managed cats and circe
"org.http4s" %% "http4s-ember-client" % "0.21.24",
"org.http4s" %% "http4s-ember-server" % "0.21.24",
"org.http4s" %% "http4s-circe" % "0.21.24",
"org.http4s" %% "http4s-dsl" % "0.21.24",
// ZIO and the interop library
"dev.zio" %% "zio" % "1.0.9",
"dev.zio" %% "zio-interop-cats" % "2.5.1.0",
"dev.zio" %% "zio-test" % "1.0.9" % "test",
"dev.zio" %% "zio-test-sbt" % "1.0.9" % "test",
)
val commonSettings = Seq(
scalacOptions ++= (if (scalaVersion.value.startsWith("2.12")) Seq("-Ypartial-unification") else Nil),
// Use zio-test runner
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
// Ensure canceling `run` releases socket, no matter what
run / fork := true,
// Better syntax for dealing with partially-applied types
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.0" cross CrossVersion.full),
// Better semantics for for comprehensions
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"),
)
lazy val exampleServer = (project in file("example-server"))
.settings(commonSettings)
.settings(
Compile / guardrailTasks += ScalaServer(file("server.yaml"), pkg="example.server", framework="http4s"),
libraryDependencies ++= commonDependencies
)
.dependsOn(exampleClient % "test")
lazy val exampleClient = (project in file("example-client"))
.settings(commonSettings)
.settings(
Compile / guardrailTasks += ScalaClient(file("server.yaml"), pkg="example.client", framework="http4s"),
libraryDependencies ++= commonDependencies
)
lazy val root = (project in file("."))
.aggregate(exampleServer, exampleClient)
.dependsOn(exampleServer, exampleClient)