forked from softwaremill/tapir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
503 lines (454 loc) · 15.4 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
val scala2_12 = "2.12.11"
val scala2_13 = "2.13.2"
lazy val is2_12 = settingKey[Boolean]("Is the scala version 2.12.")
// an ugly work-around for https://github.com/sbt/sbt/issues/3465
// even if a project is 2.12-only, we fake that it's also 2.13-compatible
val only2_12settings = Seq(
publishArtifact := is2_12.value,
skip := !is2_12.value,
skip in publish := !is2_12.value,
libraryDependencies := (if (is2_12.value) libraryDependencies.value else Nil),
mimaPreviousArtifacts := (if (is2_12.value) mimaPreviousArtifacts.value else Set.empty)
)
val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.sttp.tapir",
scalaVersion := scala2_12,
crossScalaVersions := Seq(scala2_12, scala2_13),
is2_12 := scalaVersion.value.startsWith("2.12."),
libraryDependencies ++= Seq(
compilerPlugin("com.softwaremill.neme" %% "neme-plugin" % "0.0.5"),
compilerPlugin("com.github.ghik" % "silencer-plugin" % Versions.silencer cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % Versions.silencer % Provided cross CrossVersion.full
),
mimaPreviousArtifacts := Set.empty //Set("com.softwaremill.sttp.tapir" %% name.value % "0.12.21")
)
def dependenciesFor(version: String)(deps: (Option[(Long, Long)] => ModuleID)*): Seq[ModuleID] =
deps.map(_.apply(CrossVersion.partialVersion(version)))
val scalaTest = "org.scalatest" %% "scalatest" % Versions.scalaTest
val scalaCheck = "org.scalacheck" %% "scalacheck" % Versions.scalaCheck
lazy val loggerDependencies = Seq(
"ch.qos.logback" % "logback-classic" % "1.2.3",
"ch.qos.logback" % "logback-core" % "1.2.3",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2"
)
lazy val rootProject = (project in file("."))
.settings(commonSettings)
.settings(mimaPreviousArtifacts := Set.empty)
.settings(publishArtifact := false, name := "tapir")
.aggregate(
core,
cats,
enumeratum,
refined,
zio,
circeJson,
jsoniterScala,
playJson,
sprayJson,
uPickleJson,
tethysJson,
openapiModel,
openapiCirce,
openapiCirceYaml,
openapiDocs,
swaggerUiAkka,
redocAkka,
swaggerUiHttp4s,
redocHttp4s,
swaggerUiFinatra,
serverTests,
akkaHttpServer,
http4sServer,
sttpStubServer,
finatraServer,
finatraServerCats,
playServer,
vertxServer,
zioServer,
sttpClient,
tests,
examples,
playground
)
// core
lazy val core: Project = (project in file("core"))
.settings(commonSettings)
.settings(
name := "tapir-core",
libraryDependencies ++= Seq(
"com.propensive" %% "magnolia" % "0.16.0",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"com.softwaremill.sttp.model" %% "core" % "1.1.3",
scalaTest % Test,
scalaCheck % Test,
"com.47deg" %% "scalacheck-toolbox-datetime" % "0.3.5" % Test,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Test
),
unmanagedSourceDirectories in Compile += {
val sourceDir = (baseDirectory in Compile).value / "src" / "main"
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => sourceDir / "scala-2.13+"
case _ => sourceDir / "scala-2.13-"
}
}
)
.enablePlugins(spray.boilerplate.BoilerplatePlugin)
lazy val tests: Project = (project in file("tests"))
.settings(commonSettings)
.settings(
name := "tapir-tests",
libraryDependencies ++= Seq(
"io.circe" %% "circe-generic" % Versions.circe,
"com.softwaremill.common" %% "tagging" % "2.2.1",
scalaTest,
"com.softwaremill.macwire" %% "macros" % "2.3.7" % "provided"
),
libraryDependencies ++= loggerDependencies
)
.dependsOn(core, circeJson)
// integrations
lazy val cats: Project = (project in file("integrations/cats"))
.settings(commonSettings)
.settings(
name := "tapir-cats",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.1.1",
scalaTest % Test,
scalaCheck % Test
)
)
.dependsOn(core)
lazy val enumeratum: Project = (project in file("integrations/enumeratum"))
.settings(commonSettings)
.settings(
name := "tapir-enumeratum",
libraryDependencies ++= Seq(
"com.beachape" %% "enumeratum" % Versions.enumeratum,
scalaTest % Test
)
)
.dependsOn(core)
lazy val refined: Project = (project in file("integrations/refined"))
.settings(commonSettings)
.settings(
name := "tapir-refined",
libraryDependencies ++= Seq(
"eu.timepit" %% "refined" % Versions.refined,
scalaTest % Test
)
)
.dependsOn(core)
lazy val zio: Project = (project in file("integrations/zio"))
.settings(commonSettings)
.settings(
name := "tapir-zio",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % Versions.zio,
"dev.zio" %% "zio-streams" % Versions.zio,
scalaTest % Test
)
)
.dependsOn(core)
// json
lazy val circeJson: Project = (project in file("json/circe"))
.settings(commonSettings)
.settings(
name := "tapir-json-circe",
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % Versions.circe,
"io.circe" %% "circe-parser" % Versions.circe
)
)
.dependsOn(core)
lazy val playJson: Project = (project in file("json/playjson"))
.settings(commonSettings: _*)
.settings(
name := "tapir-json-play",
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % Versions.playJson,
scalaTest % Test
)
)
.dependsOn(core)
lazy val sprayJson: Project = (project in file("json/sprayjson"))
.settings(commonSettings: _*)
.settings(
name := "tapir-json-spray",
libraryDependencies ++= Seq(
"io.spray" %% "spray-json" % Versions.sprayJson,
scalaTest % Test
)
)
.dependsOn(core)
lazy val uPickleJson: Project = (project in file("json/upickle"))
.settings(commonSettings)
.settings(
name := "tapir-json-upickle",
libraryDependencies ++= Seq(
"com.lihaoyi" %% "upickle" % Versions.upickle,
scalaTest % Test
)
)
.dependsOn(core)
lazy val tethysJson: Project = (project in file("json/tethys"))
.settings(commonSettings)
.settings(
name := "tapir-json-tethys",
libraryDependencies ++= Seq(
"com.tethys-json" %% "tethys-core" % Versions.tethys,
"com.tethys-json" %% "tethys-jackson" % Versions.tethys
)
)
.dependsOn(core)
lazy val jsoniterScala: Project = (project in file("json/jsoniter"))
.settings(commonSettings)
.settings(
name := "tapir-jsoniter-scala",
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "2.4.4",
scalaTest % Test
)
)
.dependsOn(core)
// openapi
lazy val openapiModel: Project = (project in file("openapi/openapi-model"))
.settings(commonSettings)
.settings(
name := "tapir-openapi-model"
)
.settings(libraryDependencies += scalaTest % Test)
lazy val openapiCirce: Project = (project in file("openapi/openapi-circe"))
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % Versions.circe,
"io.circe" %% "circe-parser" % Versions.circe,
"io.circe" %% "circe-generic" % Versions.circe
),
name := "tapir-openapi-circe"
)
.dependsOn(openapiModel)
lazy val openapiCirceYaml: Project = (project in file("openapi/openapi-circe-yaml"))
.settings(commonSettings)
.settings(
libraryDependencies += "io.circe" %% "circe-yaml" % Versions.circeYaml,
name := "tapir-openapi-circe-yaml"
)
.dependsOn(openapiCirce)
// docs
lazy val openapiDocs: Project = (project in file("docs/openapi-docs"))
.settings(commonSettings)
.settings(
name := "tapir-openapi-docs"
)
.dependsOn(openapiModel, core, tests % Test, openapiCirceYaml % Test)
lazy val swaggerUiAkka: Project = (project in file("docs/swagger-ui-akka-http"))
.settings(commonSettings)
.settings(
name := "tapir-swagger-ui-akka-http",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % Versions.akkaHttp,
"com.typesafe.akka" %% "akka-stream" % Versions.akkaStreams,
"org.webjars" % "swagger-ui" % Versions.swaggerUi
)
)
lazy val redocAkka: Project = (project in file("docs/redoc-akka-http"))
.settings(commonSettings)
.settings(
name := "tapir-redoc-akka-http",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % Versions.akkaHttp,
"com.typesafe.akka" %% "akka-stream" % Versions.akkaStreams
)
)
lazy val swaggerUiHttp4s: Project = (project in file("docs/swagger-ui-http4s"))
.settings(commonSettings)
.settings(
name := "tapir-swagger-ui-http4s",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl" % Versions.http4s,
"org.webjars" % "swagger-ui" % Versions.swaggerUi
)
)
lazy val redocHttp4s: Project = (project in file("docs/redoc-http4s"))
.settings(commonSettings)
.settings(
name := "tapir-redoc-http4s",
libraryDependencies += "org.http4s" %% "http4s-dsl" % Versions.http4s
)
lazy val swaggerUiFinatra: Project = (project in file("docs/swagger-ui-finatra"))
.settings(commonSettings)
.settings(
name := "tapir-swagger-ui-finatra",
libraryDependencies ++= Seq(
"com.twitter" %% "finatra-http" % Versions.finatra,
"org.webjars" % "swagger-ui" % Versions.swaggerUi
)
)
.settings(only2_12settings)
// server
lazy val serverTests: Project = (project in file("server/tests"))
.settings(commonSettings)
.settings(
name := "tapir-server-tests",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client" %% "async-http-client-backend-cats" % Versions.sttp
)
)
.dependsOn(tests)
lazy val akkaHttpServer: Project = (project in file("server/akka-http-server"))
.settings(commonSettings)
.settings(
name := "tapir-akka-http-server",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % Versions.akkaHttp,
"com.typesafe.akka" %% "akka-stream" % Versions.akkaStreams
)
)
.dependsOn(core, serverTests % Test)
lazy val http4sServer: Project = (project in file("server/http4s-server"))
.settings(commonSettings)
.settings(
name := "tapir-http4s-server",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-blaze-server" % Versions.http4s
)
)
.dependsOn(core, serverTests % Test)
lazy val sttpStubServer: Project = (project in file("server/sttp-stub-server"))
.settings(commonSettings)
.settings(
name := "tapir-sttp-stub-server"
)
.dependsOn(core, serverTests % "test", sttpClient)
lazy val finatraServer: Project = (project in file("server/finatra-server"))
.settings(commonSettings: _*)
.settings(
name := "tapir-finatra-server",
libraryDependencies ++= Seq(
"com.twitter" %% "finatra-http" % Versions.finatra,
"org.apache.httpcomponents" % "httpmime" % "4.5.12",
// Testing
"com.twitter" %% "finatra-http" % Versions.finatra % Test,
"com.twitter" %% "inject-server" % Versions.finatra % Test,
"com.twitter" %% "inject-app" % Versions.finatra % Test,
"com.twitter" %% "inject-core" % Versions.finatra % Test,
"com.twitter" %% "inject-modules" % Versions.finatra % Test,
"com.twitter" %% "finatra-http" % Versions.finatra % Test classifier "tests",
"com.twitter" %% "inject-server" % Versions.finatra % Test classifier "tests",
"com.twitter" %% "inject-app" % Versions.finatra % Test classifier "tests",
"com.twitter" %% "inject-core" % Versions.finatra % Test classifier "tests",
"com.twitter" %% "inject-modules" % Versions.finatra % Test classifier "tests"
)
)
.settings(only2_12settings)
.dependsOn(core, serverTests % Test)
lazy val finatraServerCats: Project =
(project in file("server/finatra-server/finatra-server-cats"))
.settings(commonSettings: _*)
.settings(
name := "tapir-finatra-server-cats",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % Versions.catsEffect,
"io.catbird" %% "catbird-finagle" % Versions.catbird,
"io.catbird" %% "catbird-effect" % Versions.catbird
)
)
.settings(only2_12settings)
.dependsOn(finatraServer % "compile->compile;test->test", serverTests % Test)
lazy val playServer: Project = (project in file("server/play-server"))
.settings(commonSettings)
.settings(
name := "tapir-play-server",
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-server" % Versions.playServer,
"com.typesafe.play" %% "play-akka-http-server" % Versions.playServer,
"com.typesafe.play" %% "play" % Versions.playServer
)
)
.dependsOn(core, serverTests % Test)
lazy val vertxServer: Project = (project in file("server/vertx"))
.settings(commonSettings)
.settings(
name := "tapir-vertx-server",
libraryDependencies ++= Seq(
"io.vertx" %% "vertx-web-scala" % Versions.vertx
)
)
.settings(only2_12settings)
.dependsOn(core, serverTests % Test)
lazy val zioServer: Project = (project in file("server/zio-http4-server"))
.settings(commonSettings)
.settings(
name := "tapir-zio-http4s-server",
libraryDependencies += "dev.zio" %% "zio-interop-cats" % Versions.zioInteropCats
)
.dependsOn(zio, http4sServer, serverTests % Test)
// client
lazy val clientTests: Project = (project in file("client/tests"))
.settings(commonSettings)
.settings(
name := "tapir-client-tests",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl" % Versions.http4s,
"org.http4s" %% "http4s-blaze-server" % Versions.http4s,
"org.http4s" %% "http4s-circe" % Versions.http4s
)
)
.dependsOn(tests)
lazy val sttpClient: Project = (project in file("client/sttp-client"))
.settings(commonSettings)
.settings(
name := "tapir-sttp-client",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client" %% "core" % Versions.sttp,
"com.softwaremill.sttp.client" %% "async-http-client-backend-fs2" % Versions.sttp % Test
)
)
.dependsOn(core, clientTests % Test)
// other
lazy val examples: Project = (project in file("examples"))
.settings(commonSettings)
.settings(
name := "tapir-examples",
libraryDependencies ++= Seq(
"dev.zio" %% "zio-interop-cats" % Versions.zioInteropCats,
"org.typelevel" %% "cats-effect" % Versions.catsEffect,
"org.http4s" %% "http4s-dsl" % Versions.http4s,
"com.softwaremill.sttp.client" %% "async-http-client-backend-zio" % Versions.sttp
),
libraryDependencies ++= loggerDependencies,
publishArtifact := false
)
.settings(only2_12settings)
.dependsOn(akkaHttpServer, http4sServer, sttpClient, openapiCirceYaml, openapiDocs, circeJson, swaggerUiAkka, swaggerUiHttp4s, zioServer)
lazy val playground: Project = (project in file("playground"))
.settings(commonSettings)
.settings(
name := "tapir-playground",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client" %% "akka-http-backend" % Versions.sttp,
"dev.zio" %% "zio" % Versions.zio,
"dev.zio" %% "zio-interop-cats" % Versions.zioInteropCats,
"org.typelevel" %% "cats-effect" % Versions.catsEffect,
"io.swagger" % "swagger-annotations" % "1.6.2",
"io.circe" %% "circe-generic-extras" % "0.13.0",
"com.softwaremill.sttp.client" %% "akka-http-backend" % Versions.sttp
),
libraryDependencies ++= loggerDependencies,
publishArtifact := false
)
.settings(only2_12settings)
.dependsOn(
akkaHttpServer,
http4sServer,
sttpClient,
openapiCirceYaml,
openapiDocs,
circeJson,
swaggerUiAkka,
swaggerUiHttp4s,
refined,
cats,
zioServer
)