forked from ghostdogpr/caliban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
184 lines (172 loc) · 5.46 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import sbtcrossproject.CrossPlugin.autoImport.{ crossProject, CrossType }
val mainScala = "2.12.10"
val allScala = Seq("2.13.1", mainScala)
inThisBuild(
List(
organization := "com.github.ghostdogpr",
homepage := Some(url("https://github.com/ghostdogpr/caliban")),
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
scalaVersion := mainScala,
parallelExecution in Test := false,
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc"),
scmInfo := Some(
ScmInfo(
url("https://github.com/ghostdogpr/caliban/"),
"scm:git:[email protected]:ghostdogpr/caliban.git"
)
),
developers := List(
Developer(
"ghostdogpr",
"Pierre Ricadat",
url("https://github.com/ghostdogpr")
)
),
crossScalaVersions := allScala
)
)
ThisBuild / publishTo := sonatypePublishToBundle.value
name := "caliban"
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias(
"check",
"all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck"
)
lazy val root = project
.in(file("."))
.enablePlugins(ScalaJSPlugin)
.settings(skip in publish := true)
.settings(historyPath := None)
.aggregate(coreJVM, coreJS, http4s, akkaHttp, catsInteropJVM, catsInteropJS)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(name := "caliban")
.settings(commonSettings)
.settings(
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")),
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "fastparse" % "2.2.3",
"com.propensive" %%% "magnolia" % "0.12.6",
"com.propensive" %%% "mercator" % "0.3.0",
"dev.zio" %%% "zio" % "1.0.0-RC17",
"dev.zio" %%% "zio-streams" % "1.0.0-RC17",
"dev.zio" %%% "zio-test" % "1.0.0-RC17" % "test",
"dev.zio" %%% "zio-test-sbt" % "1.0.0-RC17" % "test",
"io.circe" %%% "circe-derivation" % "0.12.0-M7" % Optional,
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
)
)
.jvmSettings(
fork in Test := true,
fork in run := true
)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js.settings(
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % "2.0.0-RC3" % Test
)
lazy val catsInterop = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("interop/cats"))
.settings(name := "caliban-cats")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-interop-cats" % "2.0.0.0-RC10",
"org.typelevel" %%% "cats-effect" % "2.0.0"
)
)
.dependsOn(core)
lazy val catsInteropJVM = catsInterop.jvm
lazy val catsInteropJS = catsInterop.js
lazy val http4s = project
.in(file("http4s"))
.settings(name := "caliban-http4s")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-interop-cats" % "2.0.0.0-RC10",
"org.typelevel" %% "cats-effect" % "2.0.0",
"org.http4s" %% "http4s-dsl" % "0.21.0-M6",
"org.http4s" %% "http4s-circe" % "0.21.0-M6",
"org.http4s" %% "http4s-blaze-server" % "0.21.0-M6",
"io.circe" %% "circe-parser" % "0.12.3",
compilerPlugin(
("org.typelevel" %% "kind-projector" % "0.11.0")
.cross(CrossVersion.full)
)
)
)
.dependsOn(coreJVM)
lazy val akkaHttp = project
.in(file("akka-http"))
.settings(name := "caliban-akka-http")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.1.11",
"com.typesafe.akka" %% "akka-stream" % "2.6.1",
"de.heikoseeberger" %% "akka-http-circe" % "1.30.0",
"io.circe" %% "circe-parser" % "0.12.3",
compilerPlugin(
("org.typelevel" %% "kind-projector" % "0.11.0")
.cross(CrossVersion.full)
)
)
)
.dependsOn(coreJVM)
lazy val examples = project
.in(file("examples"))
.settings(commonSettings)
.settings(skip in publish := true)
.dependsOn(akkaHttp, http4s, catsInteropJVM)
lazy val benchmarks = project
.in(file("benchmarks"))
.settings(commonSettings)
.settings(skip in publish := true)
.dependsOn(coreJVM)
.enablePlugins(JmhPlugin)
.settings(
libraryDependencies ++= Seq(
"org.sangria-graphql" %% "sangria" % "1.4.2",
"org.sangria-graphql" %% "sangria-circe" % "1.2.1"
)
)
val commonSettings = Def.settings(
scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-explaintypes",
"-Yrangepos",
"-feature",
"-language:higherKinds",
"-language:existentials",
"-unchecked",
"-Xlint:_,-type-parameter-shadow",
"-Ywarn-numeric-widen",
"-Ywarn-unused:patvars,-implicits",
"-Ywarn-value-discard"
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
Seq(
"-Xsource:2.13",
"-Yno-adapted-args",
"-Ypartial-unification",
"-Ywarn-extra-implicit",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit",
"-opt-inline-from:<source>",
"-opt-warnings",
"-opt:l:inline"
)
case _ => Nil
})
)