-
Notifications
You must be signed in to change notification settings - Fork 309
/
build.sbt
1162 lines (1061 loc) · 37.5 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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import com.softwaremill.Publish.{ossPublishSettings, updateDocs}
import com.softwaremill.SbtSoftwareMillCommon.commonSmlBuildSettings
import com.softwaremill.UpdateVersionInDocs
import sbt.Keys.publishArtifact
import sbt.Reference.display
import sbt.internal.ProjectMatrix
import complete.DefaultParsers._
// run JS tests inside Chrome, due to jsdom not supporting fetch
import com.softwaremill.SbtSoftwareMillBrowserTestJS._
val scala2_12 = "2.12.20"
val scala2_13 = "2.13.15"
val scala2 = List(scala2_12, scala2_13)
val scala3 = List("3.3.4")
lazy val testServerPort = settingKey[Int]("Port to run the http test server on")
lazy val startTestServer = taskKey[Unit]("Start a http server used by tests")
// slow down for CI
parallelExecution in Global := false
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)
excludeLintKeys in Global ++= Set(ideSkipProject, reStartArgs)
val scopesDescription = "Scala version can be: 2.12, 2.13, 3; platform: JVM, JS, Native"
val compileScoped =
inputKey[Unit](
s"Compiles sources in the given scope. Usage: compileScoped [scala version] [platform]. $scopesDescription"
)
val testScoped =
inputKey[Unit](s"Run tests in the given scope. Usage: testScoped [scala version] [platform]. $scopesDescription")
val commonSettings = commonSmlBuildSettings ++ ossPublishSettings ++ Seq(
organization := "com.softwaremill.sttp.client4",
updateDocs := Def.taskDyn {
val files1 = UpdateVersionInDocs(sLog.value, organization.value, version.value, List(file("README.md")))
Def.task {
(docs.jvm(scala2_13) / mdoc).toTask("").value
files1 ++ Seq(file("generated-docs/out"))
}
}.value,
ideSkipProject := (scalaVersion.value != scala2_13)
|| thisProjectRef.value.project.contains("JS") || thisProjectRef.value.project.contains("Native"),
bspEnabled := !ideSkipProject.value,
mimaPreviousArtifacts := Set.empty // we only use MiMa for `core` for now, using enableMimaSettings
)
val commonJvmSettings = commonSettings ++ Seq(
scalacOptions += "-release:11",
Test / testOptions += Tests.Argument("-oD") // add test timings; js build specify other options which conflict
)
val commonJsSettings = commonSettings ++ Seq(
scalaJSLinkerConfig ~= {
_.withBatchMode(true).withParallel(false)
},
libraryDependencies += ("org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0").cross(CrossVersion.for3Use2_13),
Compile / scalacOptions ++= {
if (isSnapshot.value) Seq.empty
else
Seq {
val mapSourcePrefix =
if (ScalaArtifacts.isScala3(scalaVersion.value))
"-scalajs-mapSourceURI"
else
"-P:scalajs:mapSourceURI"
val dir = project.base.toURI.toString.replaceFirst("[^/]+/?$", "")
val url = "https://raw.githubusercontent.com/softwaremill/sttp"
s"$mapSourcePrefix:$dir->$url/v${version.value}/"
}
}
)
val commonJsBackendSettings = JSDependenciesPlugin.projectSettings ++ List(
jsDependencies ++= Seq(
"org.webjars.npm" % "spark-md5" % "3.0.2" % Test / "spark-md5.js" minified "spark-md5.min.js"
)
)
val commonNativeSettings = commonSettings ++ Seq(
Test / test := {
// TODO: re-enable after scala-native release > 0.4.0-M2
if (sys.env.isDefinedAt("RELEASE_VERSION")) {
println("[info] Release build, skipping sttp native tests")
} else { (Test / test).value }
}
)
val versioningSchemeSettings = Seq(versionScheme := Some("early-semver"))
val enableMimaSettings = Seq(
mimaPreviousArtifacts := {
val current = version.value
val isRcOrMilestone = current.contains("M") || current.contains("RC")
if (!isRcOrMilestone) {
val previous = previousStableVersion.value
println(s"[info] Not a M or RC version, using previous version for MiMa check: $previous")
previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet
} else {
println(s"[info] $current is an M or RC version, no previous version to check with MiMa")
Set.empty
}
}
)
// start a test server before running tests of a backend; this is required both for JS tests run inside a
// nodejs/browser environment, as well as for JVM tests where akka-http isn't available (e.g. dotty). To simplify
// things, we always start the test server.
val testServerSettings = Seq(
Test / test := (Test / test)
.dependsOn(testServer2_13 / startTestServer)
.value,
Test / testOnly := (Test / testOnly)
.dependsOn(testServer2_13 / startTestServer)
.evaluated,
Test / testOptions += Tests.Setup { () =>
val port = (testServer2_13 / testServerPort).value
PollingUtils.waitUntilServerAvailable(new URL(s"http://localhost:$port"))
}
)
val circeVersion: String = "0.14.10"
val jsoniterVersion = "2.31.3"
val play29JsonVersion = "2.10.6"
val playJsonVersion = "3.0.4"
val catsEffect_3_version = "3.5.5"
val fs2_3_version = "3.11.0"
val catsEffect_2_version = "2.5.5"
val fs2_2_version = "2.5.12"
val akkaHttp = "com.typesafe.akka" %% "akka-http" % "10.2.10"
val akkaStreamVersion = "2.6.20"
val akkaStreams = "com.typesafe.akka" %% "akka-stream" % akkaStreamVersion
val pekkoHttp = "org.apache.pekko" %% "pekko-http" % "1.1.0"
val pekkoStreamVersion = "1.1.2"
val pekkoStreams = "org.apache.pekko" %% "pekko-stream" % pekkoStreamVersion
val scalaTest = libraryDependencies ++= Seq("freespec", "funsuite", "flatspec", "wordspec", "shouldmatchers").map(m =>
"org.scalatest" %%% s"scalatest-$m" % "3.2.19" % Test
)
val zio1Version = "1.0.18"
val zio2Version = "2.1.12"
val zio1InteropRsVersion = "1.3.12"
val zio2InteropRsVersion = "2.0.2"
val oxVersion = "0.5.1"
val sttpModelVersion = "1.7.11"
val sttpSharedVersion = "1.4.0"
val logback = "ch.qos.logback" % "logback-classic" % "1.5.12"
val jaegerClientVersion = "1.8.1"
val braveOpentracingVersion = "1.0.1"
val zipkinSenderOkHttpVersion = "3.4.2"
val resilience4jVersion = "2.2.0"
val http4s_ce2_version = "0.22.15"
val http4s_ce3_version = "0.23.29"
val tethysVersion = "0.29.3"
val openTelemetryVersion = "1.44.1"
val compileAndTest = "compile->compile;test->test"
lazy val loomProjects: Seq[String] = Seq(ox, examples3).flatMap(_.projectRefs).flatMap(projectId)
def projectId(projectRef: ProjectReference): Option[String] =
projectRef match {
case ProjectRef(_, id) => Some(id)
case LocalProject(id) => Some(id)
case _ => None
}
lazy val allAggregates: Seq[ProjectReference] = {
val filteredByNative = if (sys.env.isDefinedAt("STTP_NATIVE")) {
println("[info] STTP_NATIVE defined, including native in the aggregate projects")
rawAllAggregates
} else {
println("[info] STTP_NATIVE *not* defined, *not* including native in the aggregate projects")
rawAllAggregates.filterNot(_.toString.contains("Native"))
}
if (sys.env.isDefinedAt("ONLY_LOOM")) {
println("[info] ONLY_LOOM defined, including only loom-based projects")
filteredByNative.filter(p => projectId(p).forall(loomProjects.contains))
} else if (sys.env.isDefinedAt("ALSO_LOOM")) {
println("[info] ALSO_LOOM defined, including also loom-based projects")
filteredByNative
} else {
println("[info] ONLY_LOOM *not* defined, *not* including loom-based-projects")
filteredByNative.filterNot(p => projectId(p).forall(loomProjects.contains))
}
}
lazy val rawAllAggregates =
core.projectRefs ++
jsonCommon.projectRefs ++
upickle.projectRefs ++
testCompilation.projectRefs ++
catsCe2.projectRefs ++
cats.projectRefs ++
fs2Ce2.projectRefs ++
fs2.projectRefs ++
monix.projectRefs ++
ox.projectRefs ++
scalaz.projectRefs ++
zio1.projectRefs ++
zio.projectRefs ++
akkaHttpBackend.projectRefs ++
pekkoHttpBackend.projectRefs ++
asyncHttpClientBackend.projectRefs ++
asyncHttpClientFutureBackend.projectRefs ++
asyncHttpClientScalazBackend.projectRefs ++
asyncHttpClientZio1Backend.projectRefs ++
asyncHttpClientZioBackend.projectRefs ++
asyncHttpClientMonixBackend.projectRefs ++
asyncHttpClientCatsCe2Backend.projectRefs ++
asyncHttpClientCatsBackend.projectRefs ++
asyncHttpClientFs2Ce2Backend.projectRefs ++
asyncHttpClientFs2Backend.projectRefs ++
okhttpBackend.projectRefs ++
okhttpMonixBackend.projectRefs ++
http4sCe2Backend.projectRefs ++
http4sBackend.projectRefs ++
circe.projectRefs ++
zio1Json.projectRefs ++
zioJson.projectRefs ++
json4s.projectRefs ++
jsoniter.projectRefs ++
sprayJson.projectRefs ++
play29Json.projectRefs ++
playJson.projectRefs ++
tethysJson.projectRefs ++
prometheusBackend.projectRefs ++
openTelemetryMetricsBackend.projectRefs ++
openTelemetryTracingZioBackend.projectRefs ++
finagleBackend.projectRefs ++
armeriaBackend.projectRefs ++
armeriaScalazBackend.projectRefs ++
armeriaZio1Backend.projectRefs ++
armeriaZioBackend.projectRefs ++
armeriaMonixBackend.projectRefs ++
armeriaCatsCe2Backend.projectRefs ++
armeriaCatsBackend.projectRefs ++
armeriaFs2Ce2Backend.projectRefs ++
armeriaFs2Backend.projectRefs ++
scribeBackend.projectRefs ++
slf4jBackend.projectRefs ++
examplesCe2.projectRefs ++
examples.projectRefs ++
examples3.projectRefs ++
docs.projectRefs ++
testServer.projectRefs
def filterProject(p: String => Boolean) =
ScopeFilter(inProjects(allAggregates.filter(pr => p(display(pr.project))): _*))
def filterByVersionAndPlatform(scalaVersionFilter: String, platformFilter: String) = filterProject { projectName =>
val byPlatform =
if (platformFilter == "JVM") !projectName.contains("JS") && !projectName.contains("Native")
else projectName.contains(platformFilter)
val byVersion = scalaVersionFilter match {
case "3" => projectName.contains("3")
case "2.13" => !projectName.contains("2_12") && !projectName.contains("3")
case "2.12" => projectName.contains("2_12")
}
byPlatform && byVersion
}
lazy val rootProject = (project in file("."))
.settings(commonSettings: _*)
.settings(
publish / skip := true,
name := "sttp",
compileScoped := Def.inputTaskDyn {
val args = spaceDelimited("<arg>").parsed
Def.taskDyn((Compile / compile).all(filterByVersionAndPlatform(args.head, args(1))))
}.evaluated,
testScoped := Def.inputTaskDyn {
val args = spaceDelimited("<arg>").parsed
Def.taskDyn((Test / test).all(filterByVersionAndPlatform(args.head, args(1))))
}.evaluated,
ideSkipProject := false,
scalaVersion := scala2_13
)
.aggregate(allAggregates: _*)
lazy val testServer = (projectMatrix in file("testing/server"))
.settings(commonJvmSettings)
.settings(
name := "testing-server",
libraryDependencies ++= Seq(
akkaHttp,
"ch.megard" %% "akka-http-cors" % "1.2.0",
akkaStreams
),
// the test server needs to be started before running any backend tests
reStart / mainClass := Some("sttp.client4.testing.server.HttpServer"),
reStart / reStartArgs := Seq(s"${(Test / testServerPort).value}"),
reStart / fullClasspath := (Test / fullClasspath).value,
testServerPort := 51823,
startTestServer := reStart.toTask("").value
)
.jvmPlatform(scalaVersions = scala2)
lazy val testServer2_13 = testServer.jvm(scala2_13)
lazy val core = (projectMatrix in file("core"))
.settings(
name := "core",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.model" %%% "core" % sttpModelVersion,
"com.softwaremill.sttp.shared" %%% "core" % sttpSharedVersion,
"com.softwaremill.sttp.shared" %%% "ws" % sttpSharedVersion
),
scalaTest
)
.settings(testServerSettings)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings ++ versioningSchemeSettings ++ /*enableMimaSettings ++*/ List(
Test / publishArtifact := true, // allow implementations outside of this repo
scalacOptions ++= Seq("-J--add-modules", "-Jjava.net.http")
)
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings =
commonJsSettings ++ commonJsBackendSettings ++ browserChromeTestSettings ++ versioningSchemeSettings ++ List(
Test / publishArtifact := true
)
)
.nativePlatform(
scalaVersions = scala2 ++ scala3,
settings = commonNativeSettings ++ versioningSchemeSettings ++ List(
Test / publishArtifact := true
)
)
lazy val testCompilation = (projectMatrix in file("testing/compile"))
.settings(commonJvmSettings)
.settings(
name := "testing-compile",
publish / skip := true,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Test
),
scalaTest
)
.jvmPlatform(scalaVersions = List(scala2_13))
.dependsOn(core % Test)
//----- effects
lazy val catsCe2 = (projectMatrix in file("effects/cats-ce2"))
.settings(
name := "catsCe2",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % catsEffect_2_version
)
)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJsSettings ++ commonJsBackendSettings ++ browserChromeTestSettings ++ testServerSettings
)
lazy val cats = (projectMatrix in file("effects/cats"))
.settings(
name := "cats",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect-kernel" % catsEffect_3_version,
"org.typelevel" %%% "cats-effect-std" % catsEffect_3_version,
"org.typelevel" %%% "cats-effect" % catsEffect_3_version % Test
)
)
.settings(testServerSettings)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJsSettings ++ commonJsBackendSettings ++ browserChromeTestSettings ++ testServerSettings
)
lazy val fs2Ce2 = (projectMatrix in file("effects/fs2-ce2"))
.settings(
name := "fs2Ce2",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-core" % fs2_2_version
),
libraryDependencies += "com.softwaremill.sttp.shared" %% "fs2-ce2" % sttpSharedVersion
)
.settings(testServerSettings)
.dependsOn(core % compileAndTest, catsCe2 % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings ++ Seq(
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-reactive-streams" % fs2_2_version,
"co.fs2" %%% "fs2-io" % fs2_2_version
)
)
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
lazy val fs2 = (projectMatrix in file("effects/fs2"))
.settings(
name := "fs2",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-core" % fs2_3_version,
"com.softwaremill.sttp.shared" %%% "fs2" % sttpSharedVersion
)
)
.settings(testServerSettings)
.dependsOn(core % compileAndTest, cats % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings ++ Seq(
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-reactive-streams" % fs2_3_version,
"co.fs2" %%% "fs2-io" % fs2_3_version
)
)
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
lazy val monix = (projectMatrix in file("effects/monix"))
.settings(
name := "monix",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"io.monix" %%% "monix" % "3.4.1",
"com.softwaremill.sttp.shared" %%% "monix" % sttpSharedVersion
)
)
.settings(testServerSettings)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings ++ List(
libraryDependencies ++= Seq("io.monix" %% "monix-nio" % "0.1.0")
)
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJsSettings ++ commonJsBackendSettings ++ browserChromeTestSettings ++ testServerSettings
)
lazy val ox = (projectMatrix in file("effects/ox"))
.settings(commonJvmSettings)
.settings(
name := "ox",
libraryDependencies ++= Seq(
"com.softwaremill.ox" %% "core" % oxVersion
)
)
.settings(testServerSettings)
.jvmPlatform(scalaVersions = scala3)
.dependsOn(core % compileAndTest)
lazy val zio1 = (projectMatrix in file("effects/zio1"))
.settings(
name := "zio1",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-streams" % zio1Version,
"dev.zio" %%% "zio" % zio1Version,
"com.softwaremill.sttp.shared" %%% "zio1" % sttpSharedVersion
)
)
.settings(testServerSettings)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings ++ Seq(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-interop-reactivestreams" % zio1InteropRsVersion,
"dev.zio" %% "zio-nio" % "1.0.0-RC12"
)
)
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJsSettings ++ commonJsBackendSettings ++ browserChromeTestSettings ++ testServerSettings
)
lazy val zio = (projectMatrix in file("effects/zio"))
.settings(
name := "zio",
Test / publishArtifact := true,
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-streams" % zio2Version,
"dev.zio" %%% "zio" % zio2Version,
"com.softwaremill.sttp.shared" %%% "zio" % sttpSharedVersion
)
)
.settings(testServerSettings)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings ++ Seq(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-interop-reactivestreams" % zio2InteropRsVersion
)
)
)
.jsPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJsSettings ++ commonJsBackendSettings ++ browserChromeTestSettings ++ testServerSettings
)
lazy val scalaz = (projectMatrix in file("effects/scalaz"))
.settings(commonJvmSettings)
.settings(
name := "scalaz",
Test / publishArtifact := true,
libraryDependencies ++= Seq("org.scalaz" %% "scalaz-concurrent" % "7.2.36")
)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2
)
//----- backends
//-- akka
lazy val akkaHttpBackend = (projectMatrix in file("akka-http-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "akka-http-backend",
libraryDependencies ++= Seq(
akkaHttp,
// provided as we don't want to create a transitive dependency on a specific streams version,
// just as akka-http doesn't
akkaStreams % "provided",
"com.softwaremill.sttp.shared" %% "akka" % sttpSharedVersion
)
)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2
)
//-- pekko
lazy val pekkoHttpBackend = (projectMatrix in file("pekko-http-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "pekko-http-backend",
libraryDependencies ++= Seq(
pekkoHttp,
// provided as we don't want to create a transitive dependency on a specific streams version,
// just as akka-http doesn't
pekkoStreams % "provided",
"com.softwaremill.sttp.shared" %% "pekko" % sttpSharedVersion
)
)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3
)
//-- async http client
lazy val asyncHttpClientBackend = (projectMatrix in file("async-http-client-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "async-http-client-backend",
libraryDependencies ++= Seq(
"org.asynchttpclient" % "async-http-client" % "2.12.3"
)
)
.dependsOn(core % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ scala3
)
def asyncHttpClientBackendProject(proj: String, includeDotty: Boolean = false) =
ProjectMatrix(s"asyncHttpClientBackend${proj.capitalize}", file(s"async-http-client-backend/$proj"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(name := s"async-http-client-backend-$proj")
.dependsOn(asyncHttpClientBackend % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ (if (includeDotty) scala3 else Nil)
)
lazy val asyncHttpClientFutureBackend =
asyncHttpClientBackendProject("future", includeDotty = true)
.dependsOn(core % compileAndTest)
lazy val asyncHttpClientScalazBackend =
asyncHttpClientBackendProject("scalaz")
.dependsOn(scalaz % compileAndTest)
lazy val asyncHttpClientZio1Backend =
asyncHttpClientBackendProject("zio1", includeDotty = true)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-interop-reactivestreams" % zio1InteropRsVersion
)
)
.dependsOn(zio1 % compileAndTest)
lazy val asyncHttpClientZioBackend =
asyncHttpClientBackendProject("zio", includeDotty = true)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-interop-reactivestreams" % zio2InteropRsVersion
)
)
.dependsOn(zio % compileAndTest)
lazy val asyncHttpClientMonixBackend =
asyncHttpClientBackendProject("monix", includeDotty = true)
.dependsOn(monix % compileAndTest)
lazy val asyncHttpClientCatsCe2Backend =
asyncHttpClientBackendProject("cats-ce2", includeDotty = true)
.dependsOn(catsCe2 % compileAndTest)
lazy val asyncHttpClientCatsBackend =
asyncHttpClientBackendProject("cats", includeDotty = true)
.dependsOn(cats % compileAndTest)
lazy val asyncHttpClientFs2Ce2Backend =
asyncHttpClientBackendProject("fs2-ce2", includeDotty = true)
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-reactive-streams" % fs2_2_version,
"co.fs2" %% "fs2-io" % fs2_2_version
)
)
.dependsOn(catsCe2 % compileAndTest)
.dependsOn(fs2Ce2 % compileAndTest)
lazy val asyncHttpClientFs2Backend =
asyncHttpClientBackendProject("fs2", includeDotty = true)
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-reactive-streams" % fs2_3_version,
"co.fs2" %% "fs2-io" % fs2_3_version
)
)
.dependsOn(cats % compileAndTest)
.dependsOn(fs2 % compileAndTest)
//-- okhttp
lazy val okhttpBackend = (projectMatrix in file("okhttp-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "okhttp-backend",
libraryDependencies ++= Seq(
"com.squareup.okhttp3" % "okhttp" % "4.12.0"
)
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(core % compileAndTest)
def okhttpBackendProject(proj: String, includeDotty: Boolean) =
ProjectMatrix(s"okhttpBackend${proj.capitalize}", file(s"okhttp-backend/$proj"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(name := s"okhttp-backend-$proj")
.jvmPlatform(scalaVersions = scala2 ++ (if (includeDotty) scala3 else Nil))
.dependsOn(okhttpBackend % compileAndTest)
lazy val okhttpMonixBackend =
okhttpBackendProject("monix", includeDotty = true)
.dependsOn(monix % compileAndTest)
//-- http4s
lazy val http4sCe2Backend = (projectMatrix in file("http4s-ce2-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "http4s-ce2-backend",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-client" % http4s_ce2_version,
"org.http4s" %% "http4s-blaze-client" % http4s_ce2_version % Optional
)
)
.jvmPlatform(scalaVersions = scala2)
.dependsOn(catsCe2 % compileAndTest, core % compileAndTest, fs2Ce2 % compileAndTest)
lazy val http4sBackend = (projectMatrix in file("http4s-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "http4s-backend",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-client" % http4s_ce3_version,
"org.http4s" %% "http4s-ember-client" % "0.23.29" % Optional,
"org.http4s" %% "http4s-blaze-client" % "0.23.17" % Optional
),
evictionErrorLevel := Level.Info
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(cats % compileAndTest, core % compileAndTest, fs2 % compileAndTest)
//-- finagle backend
lazy val finagleBackend = (projectMatrix in file("finagle-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "finagle-backend",
libraryDependencies ++= Seq(
"com.twitter" %% "finagle-http" % "24.2.0"
)
)
.jvmPlatform(scalaVersions = scala2)
.dependsOn(core % compileAndTest)
lazy val armeriaBackend = (projectMatrix in file("armeria-backend"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(
name := "armeria-backend",
libraryDependencies += "com.linecorp.armeria" % "armeria" % "1.30.1"
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(core % compileAndTest)
def armeriaBackendProject(proj: String, includeDotty: Boolean = false) =
ProjectMatrix(s"armeriaBackend${proj.capitalize}", file(s"armeria-backend/$proj"))
.settings(commonJvmSettings)
.settings(testServerSettings)
.settings(name := s"armeria-backend-$proj")
.dependsOn(armeriaBackend % compileAndTest)
.jvmPlatform(
scalaVersions = scala2 ++ (if (includeDotty) scala3 else Nil)
)
lazy val armeriaMonixBackend =
armeriaBackendProject("monix", includeDotty = true)
.dependsOn(monix % compileAndTest)
lazy val armeriaFs2Ce2Backend =
armeriaBackendProject("fs2-ce2")
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-reactive-streams" % fs2_2_version
)
)
.dependsOn(fs2Ce2 % compileAndTest)
lazy val armeriaFs2Backend =
armeriaBackendProject("fs2")
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-reactive-streams" % fs2_3_version
)
)
.dependsOn(fs2 % compileAndTest)
lazy val armeriaCatsCe2Backend =
armeriaBackendProject("cats-ce2")
.dependsOn(catsCe2 % compileAndTest)
lazy val armeriaCatsBackend =
armeriaBackendProject("cats", includeDotty = true)
.dependsOn(cats % compileAndTest)
lazy val armeriaScalazBackend =
armeriaBackendProject("scalaz")
.dependsOn(scalaz % compileAndTest)
lazy val armeriaZio1Backend =
armeriaBackendProject("zio1", includeDotty = true)
.settings(
libraryDependencies ++= Seq("dev.zio" %% "zio-interop-reactivestreams" % zio1InteropRsVersion)
)
.dependsOn(zio1 % compileAndTest)
lazy val armeriaZioBackend =
armeriaBackendProject("zio", includeDotty = true)
.settings(
libraryDependencies ++= Seq("dev.zio" %% "zio-interop-reactivestreams" % zio2InteropRsVersion)
)
.dependsOn(zio % compileAndTest)
//----- json
lazy val jsonCommon = (projectMatrix in (file("json/common")))
.settings(
name := "json-common"
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.nativePlatform(scalaVersions = scala2 ++ scala3, settings = commonNativeSettings)
.dependsOn(core)
lazy val circe = (projectMatrix in file("json/circe"))
.settings(
name := "circe",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion % Test
),
scalaTest
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.nativePlatform(scalaVersions = scala2 ++ scala3, settings = commonNativeSettings)
.dependsOn(core, jsonCommon)
lazy val jsoniter = (projectMatrix in file("json/jsoniter"))
.settings(
name := "jsoniter",
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-core" % jsoniterVersion,
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-macros" % jsoniterVersion % Test
),
scalaTest
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.dependsOn(core, jsonCommon)
lazy val zioJson = (projectMatrix in file("json/zio-json"))
.settings(
name := "zio-json",
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-json" % "0.7.3",
"com.softwaremill.sttp.shared" %%% "zio" % sttpSharedVersion
),
scalaTest
)
.jvmPlatform(
scalaVersions = Seq(scala2_12, scala2_13) ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.dependsOn(core, jsonCommon)
lazy val zio1Json = (projectMatrix in file("json/zio1-json"))
.settings(
name := "zio1-json",
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-json" % "0.2.0",
"com.softwaremill.sttp.shared" %%% "zio1" % sttpSharedVersion
),
scalaTest
)
.jvmPlatform(
scalaVersions = Seq(scala2_12, scala2_13) ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.dependsOn(core, jsonCommon)
lazy val tethysJson = (projectMatrix in file("json/tethys-json"))
.settings(
name := "tethys-json",
libraryDependencies ++= Seq(
"com.tethys-json" %% "tethys-core" % tethysVersion,
"com.tethys-json" %% "tethys-jackson213" % tethysVersion % Test,
"com.tethys-json" %% "tethys-derivation" % tethysVersion % Test
),
scalaTest
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.dependsOn(core, jsonCommon)
lazy val upickle = (projectMatrix in file("json/upickle"))
.settings(
name := "upickle",
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "upickle" % "3.3.1"
),
scalaTest,
// using macroRW causes a "match may not be exhaustive" error
Test / scalacOptions --= Seq("-Wconf:cat=other-match-analysis:error")
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.nativePlatform(scalaVersions = scala2 ++ scala3, settings = commonNativeSettings)
.dependsOn(core, jsonCommon)
lazy val json4sVersion = "4.0.7"
lazy val json4s = (projectMatrix in file("json/json4s"))
.settings(commonJvmSettings)
.settings(
name := "json4s",
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-core" % json4sVersion,
"org.json4s" %% "json4s-native" % json4sVersion % Test
),
scalaTest
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(core, jsonCommon)
lazy val sprayJson = (projectMatrix in file("json/spray-json"))
.settings(commonJvmSettings)
.settings(
name := "spray-json",
libraryDependencies ++= Seq(
"io.spray" %% "spray-json" % "1.3.6"
),
scalaTest
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(core, jsonCommon)
lazy val play29Json = (projectMatrix in file("json/play29-json"))
.settings(
name := "play29-json",
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "json" / "play-json" / "src" / "main" / "scala",
Test / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "json" / "play-json" / "src" / "test" / "scala",
libraryDependencies ++= Seq(
"com.typesafe.play" %%% "play-json" % play29JsonVersion
),
scalaTest
)
.jvmPlatform(
scalaVersions = scala2,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2, settings = commonJsSettings)
.dependsOn(core, jsonCommon)
lazy val playJson = (projectMatrix in file("json/play-json"))
.settings(
name := "play-json",
libraryDependencies ++= Seq(
"org.playframework" %%% "play-json" % playJsonVersion
),
scalaTest
)
.jvmPlatform(
scalaVersions = scala2 ++ scala3,
settings = commonJvmSettings
)
.jsPlatform(scalaVersions = scala2 ++ scala3, settings = commonJsSettings)
.dependsOn(core, jsonCommon)
lazy val prometheusBackend = (projectMatrix in file("observability/prometheus-backend"))
.settings(commonJvmSettings)
.settings(
name := "prometheus-backend",
libraryDependencies ++= Seq(
"io.prometheus" % "prometheus-metrics-core" % "1.3.3"
),
scalaTest
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(core)
lazy val openTelemetryMetricsBackend = (projectMatrix in file("observability/opentelemetry-metrics-backend"))
.settings(commonJvmSettings)
.settings(
name := "opentelemetry-metrics-backend",
libraryDependencies ++= Seq(
"io.opentelemetry" % "opentelemetry-api" % openTelemetryVersion,
"io.opentelemetry" % "opentelemetry-sdk-testing" % openTelemetryVersion % Test
),
scalaTest
)
.jvmPlatform(scalaVersions = scala2 ++ scala3)
.dependsOn(core)
lazy val openTelemetryTracingZioBackend = (projectMatrix in file("observability/opentelemetry-tracing-zio-backend"))
.settings(commonJvmSettings)
.settings(
name := "opentelemetry-tracing-zio-backend",