-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.sbt
271 lines (240 loc) · 8.39 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
inThisBuild(
List(
organization := "io.github.kitlangton",
scalaVersion := "3.3.4",
homepage := Some(url("https://github.com/kitlangton/neotype")),
licenses := List("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer("kitlangton", "Kit Langton", "kit.langton@gmail.com", url("https://github.com/kitlangton"))
),
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
)
Global / onChangedBuildSource := ReloadOnSourceChanges
////////////////////////
// sbt-github-actions //
////////////////////////
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"))
ThisBuild / githubWorkflowEnv := Map("JAVA_OPTS" -> "-Xmx4g")
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches :=
Seq(
RefPredicate.StartsWith(Ref.Tag("v")),
RefPredicate.Equals(Ref.Branch("main"))
)
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
commands = List("ci-release"),
name = Some("Publish project"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
)
/////////////////////////
// Project Definitions //
/////////////////////////
lazy val jsoniterVersion = "2.31.0"
lazy val circeVersion = "0.14.10"
lazy val tapirVersion = "1.11.7"
lazy val zioVersion = "2.1.11"
lazy val zioConfigVersion = "4.0.2"
lazy val zioSchemaVersion = "1.5.0"
lazy val zioJsonVersion = "0.7.3"
lazy val chimneyVersion = "1.5.0"
lazy val calibanVersion = "2.9.0"
lazy val doobieVersion = "1.0.0-RC6"
val sharedSettings = Seq(
scalacOptions ++= Seq(
"-deprecation",
"-Xcheck-macros",
"-Wunused:all"
),
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-test" % zioVersion % Test,
"dev.zio" %%% "zio-test-sbt" % zioVersion % Test
)
)
lazy val root = (project in file("."))
.settings(
name := "neotype"
)
.aggregate(
circe.js,
circe.jvm,
core.js,
core.jvm,
jsoniter.js,
jsoniter.jvm,
playJson.js,
playJson.jvm,
examples,
tapir.js,
tapir.jvm,
zioConfig,
zioJson.js,
zioJson.jvm,
zioQuill,
zioSchema.js,
zioSchema.jvm,
zioTest.js,
zioTest.jvm,
chimney.js,
chimney.jvm,
caliban.jvm,
doobie.jvm
)
lazy val core = (crossProject(JSPlatform, JVMPlatform) in file("modules/core"))
.settings(
name := "neotype",
sharedSettings
)
lazy val circe = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-circe"))
.settings(
name := "neotype-circe",
sharedSettings,
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val jsoniter = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-jsoniter"))
.settings(
name := "neotype-jsoniter",
sharedSettings,
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-core" % jsoniterVersion,
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-macros" % jsoniterVersion
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val playJson = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-play-json"))
.settings(
name := "neotype-play-json",
sharedSettings,
libraryDependencies ++= Seq(
"org.playframework" %%% "play-json" % "3.1.0-M1"
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val tapir = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-tapir"))
.settings(
name := "neotype-tapir",
sharedSettings,
libraryDependencies ++= Seq(
"com.softwaremill.sttp.tapir" %%% "tapir-core" % tapirVersion,
"com.softwaremill.sttp.tapir" %%% "tapir-json-pickler" % tapirVersion
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val zioConfig = (project in file("modules/neotype-zio-config"))
.settings(
name := "neotype-zio-config",
sharedSettings,
libraryDependencies ++= Seq(
"dev.zio" %% "zio-config" % zioConfigVersion,
"dev.zio" %% "zio-config-magnolia" % zioConfigVersion
)
)
.dependsOn(core.jvm % "compile->compile;test->test")
lazy val zioSchema = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-zio-schema"))
.settings(
name := "neotype-zio-schema",
sharedSettings,
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-schema" % zioSchemaVersion,
"dev.zio" %%% "zio-schema-json" % zioSchemaVersion % Test
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val zioJson = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-zio-json"))
.settings(
name := "neotype-zio-json",
sharedSettings,
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-json" % zioJsonVersion
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val zioQuill = (project in file("modules/neotype-zio-quill"))
.settings(
name := "neotype-zio-quill",
sharedSettings,
libraryDependencies ++= Seq(
"io.getquill" %% "quill-jdbc-zio" % "4.8.6",
"org.postgresql" % "postgresql" % "42.7.4" % Test,
"com.h2database" % "h2" % "2.3.232" % Test
)
)
.dependsOn(core.jvm % "compile->compile;test->test")
lazy val zioTest = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-zio-test"))
.settings(
name := "neotype-zio-test",
sharedSettings,
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-test" % zioVersion,
"dev.zio" %%% "zio-test-magnolia" % zioVersion
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val chimney = (crossProject(JSPlatform, JVMPlatform) in file("modules/neotype-chimney"))
.settings(
name := "neotype-chimney",
sharedSettings,
libraryDependencies ++= Seq("io.scalaland" %%% "chimney" % chimneyVersion)
)
.dependsOn(core % "compile->compile;test->test")
lazy val caliban = (crossProject(JVMPlatform) in file("modules/neotype-caliban"))
.settings(
name := "neotype-caliban",
sharedSettings,
libraryDependencies ++= Seq(
"com.github.ghostdogpr" %% "caliban" % calibanVersion
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val doobie = (crossProject(JVMPlatform) in file("modules/neotype-doobie"))
.settings(
name := "neotype-doobie",
sharedSettings,
libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-core" % doobieVersion,
"org.tpolecat" %% "doobie-postgres" % doobieVersion % Test,
"com.h2database" % "h2" % "2.3.232" % Test
)
)
.dependsOn(core % "compile->compile;test->test")
lazy val examples = (project in file("examples"))
.settings(
name := "neotype-examples",
sharedSettings,
publish / skip := true
)
.dependsOn(core.jvm, zioJson.jvm, zioQuill)
addCommandAlias("prepare", "scalafixAll;scalafmtAll;githubWorkflowGenerate")
welcomeMessage
def welcomeMessage =
onLoadMessage := {
import scala.Console
def header(text: String): String = s"${Console.RED}$text${Console.RESET}"
def item(text: String): String = s"${Console.GREEN}> ${Console.CYAN}$text${Console.RESET}"
s"""|${header(" _ _ _____ _____ _______ _______ _____ ")}
|${header("| \\ | | ___| _ |_ _\\ \\ / | ___ | ___|")}
|${header("| \\| | |__ | | | | | | \\ V /| |_/ | |__ ")}
|${header("| . ` | __|| | | | | | \\ / | __/| __|")}
|${header("| |\\ | |___\\ \\_/ / | | | | | | | |___")}
|${header("\\_| \\_\\____/ \\___/ \\_/ \\_/ \\_| \\____/")}
|${header("——————————————————————————————————————————")}
|${header("———————— NEWTYPES + REFINED TYPES ————————")}
|${header("——————————————————————————————————————————")}
|Useful sbt tasks:
|${item("prepare")} - Runs scalafix and scalafmt on all files
|${item("~compile")} - Compiles all modules (file-watch enabled)
|${item("test")} - Runs all tests
""".stripMargin
}