-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
453 lines (426 loc) · 18.6 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
import scala.sys.process.*
import scala.util.Try
Global / onChangedBuildSource := ReloadOnSourceChanges
lazy val v = Versions
lazy val sandbox = (project in file("sandbox"))
.settings(
Settings.common2,
description := "sandbox, cat effects 3 based",
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % "3.10.2",
"co.fs2" %% "fs2-io" % "3.10.2",
// enum
"com.beachape" %% "enumeratum" % "1.7.4",
"com.beachape" %% "enumeratum-circe" % "1.7.4",
"com.beachape" %% "enumeratum-cats" % "1.7.4",
"com.beachape" %% "enumeratum-scalacheck" % "1.7.4",
// json
"io.circe" %% "circe-parser" % "0.14.9",
"io.circe" %% "circe-generic-extras" % "0.14.4",
"io.circe" %% "circe-fs2" % "0.14.1",
// twiddles
"org.typelevel" %% "twiddles-core" % "0.9.0",
),
)
lazy val mono101 = (project in file("mono101"))
.settings(
Settings.common2,
libraryDependencies ++= Seq(
"dev.optics" %% "monocle-core" % "3.2.0",
"dev.optics" %% "monocle-macro" % "3.2.0"
)
)
lazy val munitx = (project in file("munitx"))
.settings(
Settings.common2,
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "1.0.0",
"org.scalameta" %% "munit-scalacheck" % "1.0.0",
"org.typelevel" %% "munit-cats-effect" % "2.0.0",
"org.tpolecat" %% "skunk-core" % "0.6.4",
"org.postgresql" % "postgresql" % "42.7.3",
)
)
lazy val algorithms = (project in file("algorithms"))
.settings(
Settings.common2,
// compiled with JDK17
libraryDependencies += "org.projectlombok" % "lombok" % "1.18.34" % Provided,
libraryDependencies += "org.springframework.security" % "spring-security-crypto" % "6.3.0",
libraryDependencies += "co.fs2" %% "fs2-core" % "3.10.2",
)
lazy val amt = (project in file("amt"))
.settings(
Settings.common2,
description := "AMT WSDL experiments",
libraryDependencies ++= Seq(
"org.apache.axis" % "axis" % "1.4", // no transitive
"org.apache.axis" % "axis-saaj" % "1.4", // no transitive
"org.apache.axis" % "axis-jaxrpc" % "1.4", // no transitive
"axis" % "axis-wsdl4j" % "1.5.1", // no transitive
// "wsdl4j" % "wsdl4j" % "1.6.3", // no transitive
// just to avoid warnings in runtime
"commons-discovery" % "commons-discovery" % "0.5", // transitive: commons-logging" % "commons-logging" % "1.1.1"
"javax.mail" % "mail" % "1.4.7" // transitive: "javax.activation" % "activation" % "1.1",
)
)
lazy val ce2 = project
.in(file("ce2"))
.settings(
Settings.common2,
// evictionErrorLevel := util.Level.Warn,
description := "Cats Effects 2",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0",
"org.typelevel" %% "cats-effect" % "2.5.5",
"org.typelevel" %% "cats-effect-laws" % "2.5.5",
"io.circe" %% "circe-generic-extras" % "0.14.3", // generic derivation: "circe-generic" => "circe-core"
"org.http4s" %% "http4s-ember-server" % "0.21.34",
"org.http4s" %% "http4s-ember-client" % "0.21.34",
"org.http4s" %% "http4s-circe" % "0.21.34",
"org.http4s" %% "http4s-dsl" % "0.21.34",
"org.scala-lang" % "scala-reflect" % v.vScala213,
"org.typelevel" %% "cats-tagless-macros" % "0.11",
"org.scalameta" %% "munit-scalacheck" % "0.7.8",
"org.typelevel" %% "munit-cats-effect-2" % "1.0.6",
"ch.qos.logback" % "logback-classic" % "1.4.7",
"org.mongodb.scala" %% "mongo-scala-driver" % "4.9.0"
),
dependencyOverrides ++= Seq(
"io.circe" %% "circe-core" % "0.14.5"
)
)
lazy val ce3 = (project in file("ce3"))
.enablePlugins(LaikaPlugin)
.settings(
Settings.common2,
description := "CE3-based-related",
libraryDependencies ++= Seq(
// core
"org.typelevel" %% "cats-core" % "2.12.0",
"org.typelevel" %% "cats-effect" % "3.5.7",
// stm
"io.github.timwspence" %% "cats-stm" % "0.13.5",
// streams
"co.fs2" %% "fs2-core" % "3.11.0",
"co.fs2" %% "fs2-io" % "3.11.0",
// enum
"com.beachape" %% "enumeratum" % "1.7.3",
"com.beachape" %% "enumeratum-circe" % "1.7.3",
"com.beachape" %% "enumeratum-cats" % "1.7.3",
"com.beachape" %% "enumeratum-doobie" % "1.7.3", // 1.7.4 brings doobie 1.0.0-RC4
"com.beachape" %% "enumeratum-scalacheck" % "1.7.3",
// json
"io.circe" %% "circe-parser" % "0.14.9",
"io.circe" %% "circe-optics" % "0.14.1", // 0.15.0
"io.circe" %% "circe-generic-extras" % "0.14.4",
"io.circe" %% "circe-yaml" % "0.14.2", // 0.15.1
"io.circe" %% "circe-fs2" % "0.14.1",
"io.circe" %% "circe-shapes" % "0.14.7",
"io.circe" %% "circe-testing" % "0.14.7",
// munit
"org.scalameta" %% "munit" % "1.0.0",
"org.scalameta" %% "munit-scalacheck" % "1.0.0",
"org.typelevel" %% "munit-cats-effect" % "2.0.0",
// cats logging
"org.typelevel" %% "log4cats-core" % "2.7.0",
"org.typelevel" %% "log4cats-slf4j" % "2.7.0",
//
"com.github.fd4s" %% "fs2-kafka" % "3.6.0",
"org.typelevel" %% "cats-parse" % "1.0.0",
"com.github.cb372" %% "cats-retry" % "3.1.3",
// http
"org.http4s" %% "http4s-core" % "0.23.27",
"org.http4s" %% "http4s-dsl" % "0.23.27",
"org.http4s" %% "http4s-circe" % "0.23.27",
"org.http4s" %% "http4s-ember-server" % "0.23.27",
"org.http4s" %% "http4s-ember-client" % "0.23.27",
"org.http4s" %% "http4s-blaze-server" % "0.23.16",
"org.http4s" %% "http4s-blaze-client" % "0.23.16",
// tapir
"com.softwaremill.sttp.tapir" %% "tapir-core" % "1.11.1",
"com.softwaremill.sttp.tapir" %% "tapir-json-circe" % "1.11.1",
"com.softwaremill.sttp.tapir" %% "tapir-http4s-server" % "1.11.1",
"org.scalameta" %% "scalameta" % "4.9.9",
// other
"io.kubernetes" % "client-java-api" % "20.0.1",
"io.kubernetes" % "client-java" % "20.0.1",
"jakarta.mail" % "jakarta.mail-api" % "2.1.3",
"io.scalaland" %% "chimney" % "1.4.0",
"org.tpolecat" %% "skunk-core" % "0.6.4",
"io.7mind.izumi" %% "logstage-core" % "1.2.10",
"org.tpolecat" %% "doobie-core" % "1.0.0-RC2",
"org.tpolecat" %% "doobie-postgres" % "1.0.0-RC2",
"org.tpolecat" %% "doobie-hikari" % "1.0.0-RC2",
Libraries.sqlPostgres,
Libraries.newtype,
Libraries.refinedCore,
Libraries.shapeless,
"com.kubukoz" %% "debug-utils" % "1.1.3",
Libraries.catsMtl,
Libraries.jsoup,
// google API
"com.google.apis" % "google-api-services-calendar" % "v3-rev20240705-2.0.0",
"com.google.oauth-client" % "google-oauth-client-jetty" % "1.36.0",
"com.google.api-client" % "google-api-client" % "2.7.0",
"com.github.fd4s" %% "vulcan" % "1.11.1", // apache avro + cats-free monad
"com.github.fd4s" %% "vulcan-generic" % "1.11.1", // vulcan + shapeless + magnolia
"com.github.fd4s" %% "vulcan-enumeratum" % "1.11.1", // vulcan + vulcan-generic + enumeratum
"com.github.fd4s" %% "fs2-kafka-vulcan" % "3.6.0",
),
// laika experiments
laikaSite / target := target.value / "docs1",
laikaIncludePDF := true,
laikaPDF / artifactPath := target.value / "my-docs.pdf"
)
.enablePlugins(ScalaxbPlugin)
.settings(
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
)
lazy val `ce3-docs` = (project in file("ce3-docs"))
.settings(
Settings.common2,
libraryDependencies += "io.github.cibotech" %% "evilplot" % "0.9.1",
mdocVariables := Map(
"VERSION" -> version.value
)
)
.enablePlugins(MdocPlugin)
lazy val httpt = (project in file("httpt"))
.settings(
Settings.common2,
description := "HTTP load tests",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl" % "1.0.0-M41",
"org.http4s" %% "http4s-circe" % "1.0.0-M41",
"org.http4s" %% "http4s-ember-server" % "1.0.0-M41",
"org.http4s" %% "http4s-blaze-server" % "1.0.0-M40",
"org.http4s" %% "http4s-jetty-server" % "1.0.0-M32",
"org.typelevel" %% "log4cats-core" % "2.7.0",
"org.typelevel" %% "log4cats-slf4j" % "2.7.0"
),
dependencyOverrides ++= Seq(
"org.http4s" %% "http4s-core" % "1.0.0-M41",
"org.http4s" %% "http4s-server" % "1.0.0-M41"
)
)
// sbt k8a/docker:publishLocal
// docker images | grep k8a
lazy val k8a = (project in file("k8a"))
.enablePlugins(JavaAppPackaging, DockerPlugin)
.settings(
dockerBaseImage := "openjdk:11-jre-slim",
dockerExposedPorts := Seq(8080),
dockerGroupLayers := {
case (_, path) if path.startsWith("alexr") => 2
case _ => 1
},
description := "artifact to experiment with k8",
Settings.common2,
libraryDependencies ++= Seq(
"com.github.cb372" %% "cats-retry" % "3.1.0",
"org.http4s" %% "http4s-dsl" % "1.0.0-M36",
"org.http4s" %% "http4s-blaze-server" % "1.0.0-M36",
"org.http4s" %% "http4s-circe" % "1.0.0-M36",
"io.circe" %% "circe-generic-extras" % "0.14.2"
)
)
/** - create image: `sbt k8d/docker:publishLocal`
* - see what's created: `docker images | grep explore-docker-plugin`
* - look for the layers: `brew install dive`
* - run: `docker run explore-docker-plugin:1.2.3`
* - remove ALL containers created: `docker rm -vf $(docker ps -aq)`
* - remove ALL images created: `docker rmi -f $(docker images -aq)`
* - remove ALL docker artifacts: `docker system prune -a`
*/
val noopProcessLogger: ProcessLogger = ProcessLogger(_ => (), _ => ())
def run(cmd: String): Option[String] = Try(cmd.split(" ").toSeq.!!(noopProcessLogger).trim).toOption
def git(cmd: String): Option[String] = run(s"git $cmd")
def hash: Option[String] = git("rev-parse --short HEAD")
def branch: Option[String] = git("rev-parse --abbrev-ref HEAD")
lazy val k8d = (project in file("k8d"))
.enablePlugins(BuildInfoPlugin)
.enablePlugins(JavaAppPackaging, DockerPlugin)
.settings(
// https://github.com/sbt/sbt-buildinfo
// https://www.youtube.com/watch?v=sAt0mwOVKAM
// https://github.com/DevInsideYou/buildinfo/tree/main
buildInfoPackage := "alexr.explore.meta",
buildInfoObject := "BuildInfoImpl",
buildInfoOptions ++= Seq(
BuildInfoOption.Traits("BuildInfo"),
BuildInfoOption.BuildTime,
),
buildInfoKeys ++= Seq[BuildInfoKey](
"branch" -> branch,
"hash" -> hash,
),
// https://www.scala-sbt.org/sbt-native-packager/formats/docker.html
/** https://hub.docker.com/_/eclipse-temurin
* openjdk:8-jre-alpine - 89 Mb
* openjdk:8-alpine - 109 Mb
* eclipse-temurin:8-jre - 219 Mb
* eclipse-temurin:8-jre-jammy - 219 Mb
* eclipse-temurin:17.0.11_9-jre-jammy - 253 Mb
* eclipse-temurin:22-jre-jammy - 271 Mb
*/
dockerBaseImage := "eclipse-temurin:8-jre",
// group layers to optimize the docker build
dockerGroupLayers := {
case (_, path) if path.startsWith("alexr") => 2
case _ => 1
},
// https://piotrminkowski.com/2023/11/07/slim-docker-images-for-java/
/** -Dqwe=asd goes to JVM PROPERTIES
* abc123 goes to MAIN AGRS
*/
dockerCmd := Seq("-Dqwe=asd", "abc123"),
/** this goes to ENVIRONMENT */
dockerEnvVars ++= Map("asd" -> "zxc"),
Docker / packageName := "explore-docker-plugin",
Docker / version := "1.2.3",
// other things
Settings.common2.init,
libraryDependencies += LibrariesLihaoyi.pprint,
)
lazy val fp_red = (project in file("fp_red"))
.settings(
Settings.common2,
description := "FP in Scala (RED Book) Mostly plain Scala only a few libraries involved",
)
/** Project to investigate Li Haoyi libraries https://www.lihaoyi.com https://www.handsonscala.com
* https://github.com/lihaoyi
*
* +request +ujson: upickle vs ujson +api_macros
*/
lazy val lihaoyi = (project in file("lihaoyi"))
.settings(
Settings.common2,
libraryDependencies ++= Seq(
LibrariesLihaoyi.upickle,
LibrariesLihaoyi.ujson,
LibrariesLihaoyi.osLib,
LibrariesLihaoyi.scalatags,
LibrariesLihaoyi.requests,
LibrariesLihaoyi.geny,
LibrariesLihaoyi.fastparse,
"org.commonmark" % "commonmark" % "0.21.0"
)
)
/** protobuf experiments */
lazy val pbx = (project in file("pbx"))
.enablePlugins(ScalaxbPlugin)
.settings(
Settings.common2,
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
)
lazy val plain2 = (project in file("plain2"))
.settings(
Settings.common2,
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.12.0",
"io.chymyst" %% "curryhoward" % "0.3.8",
"com.softwaremill.quicklens" %% "quicklens" % "1.9.7",
)
)
/** starting from 3.2.0 it has 2.13 support */
lazy val sparkx = (project in file("sparkx"))
.settings(
Settings.common2,
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "3.5.3",
"org.apache.spark" %% "spark-sql" % "3.5.3"
),
)
lazy val typesafe = (project in file("typesafe"))
.settings(
description := "Lightbend (Typesafe) Stack: Akka, Akka-Streams, Akka-Http Play, Lagom, Slick (https://www.lightbend.com)",
Settings.common2,
libraryDependencies ++= Seq(
Libraries.cats,
Libraries.sqlPostgres,
"com.typesafe.akka" %% "akka-actor" % "2.6.21",
"com.typesafe.akka" %% "akka-actor-typed" % "2.6.21",
"com.typesafe.akka" %% "akka-stream" % "2.6.21",
"com.typesafe.akka" %% "akka-stream-kafka" % "2.0.7",
"com.typesafe.akka" %% "akka-stream-contrib" % "0.10",
"org.reactivestreams" % "reactive-streams" % "1.0.4",
"com.typesafe.akka" %% "akka-http" % "10.5.0",
"com.typesafe.akka" %% "akka-http-spray-json" % "10.5.0",
"com.typesafe.slick" %% "slick" % "3.4.1",
"com.typesafe.slick" %% "slick-hikaricp" % "3.4.1",
"com.typesafe.play" %% "play-json" % "2.9.4",
"com.typesafe" % "config" % "1.4.2",
"ch.qos.logback" % "logback-classic" % "1.5.7"
)
)
lazy val zio2 = (project in file("zio2"))
.settings(
description := "ZIO v2",
Settings.common2,
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.12.0",
"com.beachape" %% "enumeratum" % "1.7.3",
"dev.zio" %% "zio" % "2.1.3",
"dev.zio" %% "zio-streams" % "2.1.3",
"dev.zio" %% "zio-json" % "0.7.0",
"dev.zio" %% "zio-logging" % "2.3.0",
"dev.zio" %% "zio-logging-slf4j-bridge" % "2.3.0",
"dev.zio" %% "zio-interop-cats" % "23.1.0.2",
"dev.zio" %% "zio-mock" % "1.0.0-RC12",
"dev.zio" %% "zio-test" % "2.1.3" % Test,
"dev.zio" %% "zio-test-sbt" % "2.1.1" % Test,
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
)
lazy val spring = (project in file("spring"))
.settings(
description := "SpringBoot Experiments",
Settings.common2,
libraryDependencies ++= Seq(
"org.projectlombok" % "lombok" % "1.18.34",
"org.springframework.boot" % "spring-boot-starter-web" % "3.3.2",
),
)
lazy val http4sws = (project in file("http4sws"))
.settings(
description := "WebSocket with http4s, cats-parse, cats effects, fs2 Streams",
Settings.common2,
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-dsl" % "0.23.27",
"org.http4s" %% "http4s-circe" % "0.23.27",
"org.http4s" %% "http4s-ember-server" % "0.23.27",
"io.circe" %% "circe-generic" % "0.14.9",
"org.typelevel" %% "cats-parse" % "1.0.0",
"ch.qos.logback" % "logback-classic" % "1.5.7",
)
)
lazy val `macros2-core` = (project in file("macros2-core"))
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-io" % "3.10.2",
),
Settings.common2,
)
lazy val `macros2-playground` = (project in file("macros2-playground"))
.dependsOn(`macros2-core`)
.settings(
Settings.common2,
)
lazy val `macros3-core` = (project in file("macros3-core"))
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-io" % "3.10.2",
),
Settings.common3,
)
/** and not only macros... */
lazy val `macros3-playground` = (project in file("macros3-playground"))
.dependsOn(`macros3-core`)
.settings(
Settings.common3,
)