-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
457 lines (404 loc) · 16.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
454
455
456
457
import org.scalajs.linker.interface.ModuleSplitStyle
import _root_.scala.sys.process.Process
import _root_.scala.{ Console => csl }
Global / onChangedBuildSource := ReloadOnSourceChanges
Global / onLoad := {
val GREEN = csl.GREEN
val RESET = csl.RESET
println(s"""$GREEN
|$GREEN ███████╗ ██████╗ █████╗ ██╗ █████╗
|$GREEN ██╔════╝ ██╔════╝ ██╔══██╗ ██║ ██╔══██╗
|$GREEN ███████╗ ██║ ███████║ ██║ ███████║
|$GREEN ╚════██║ ██║ ██╔══██║ ██║ ██╔══██║
|$GREEN ███████║ ╚██████╗ ██║ ██║ ███████╗ ██║ ██║
|$GREEN ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝
|$RESET v.${version.value}
|""".stripMargin)
(Global / onLoad).value
}
lazy val commonSettingsJs = Settings.valueJs ++ Information.value
lazy val commonSettings = Settings.value ++ Settings.testReport ++ Information.value
lazy val scala = (project in file("."))
.aggregate(
advanced,
`akka-classic`,
`akka-typed`,
`akka-fsm`,
`akka-http`,
`sensor-controller`,
algorithms,
`alpakka-kafka`,
`alpakka-mongodb`,
`alpakka-sqs`,
`alpakka-sns`,
`aws-cdk`,
`aws-sdk`,
basic,
benchmarks,
`cats-calculator`,
`cats-console`,
foundations,
`grpc-account`,
http4s,
json,
reflection,
script,
slick,
`scalajs-facades`,
// slinky, scalajs Error downloading org.scoverage
spark,
sttp,
tapir,
// `terraform-cdktf`, scalajs Error downloading org.scoverage
`zio-akka-cluster-chat`,
`zio-akka-cluster-sharding`,
`zio-kafka`,
`zio-queues`,
`zio-s3`,
`zio-schedule`,
`zio-sqs`,
`zio-streams`
)
// S E T T I N G S
.settings(commonSettings)
.settings(Settings.noPublish)
.settings(commands ++= Commands.value)
.settings(commands += Commands.frontendDevCommand("slinky"))
.settings(commands += Commands.frontendDevCommand("docs"))
.settings(welcomeMessage)
lazy val advanced = (project in file("modules/foundations/advanced"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.advanced)
lazy val `akka-classic` = (project in file("modules/akka/classic"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
// S E T T I N G S
.settings(commonSettings)
.settings(NexusSettings.value)
.settings(libraryDependencies ++= Dependencies.`akka-classic`)
lazy val `akka-typed` = (project in file("modules/akka/typed"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
// S E T T I N G S
.settings(commonSettings)
.settings(NexusSettings.value)
.settings(libraryDependencies ++= Dependencies.`akka-typed`)
lazy val `alpakka-kafka` = (project in file("modules/alpakka/kafka"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`alpakka-kafka`)
lazy val `alpakka-mongodb` = (project in file("modules/alpakka/mongodb"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`alpakka-mongodb`)
lazy val `alpakka-sqs` = (project in file("modules/alpakka/sqs"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`alpakka-sqs`)
lazy val `alpakka-sns` = (project in file("modules/alpakka/sns"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`alpakka-sns`)
lazy val `aws-cdk` = (project in file("modules/aws/cdk"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
// S E T T I N G S
.settings(Defaults.itSettings)
.settings(AssemblySettings.value)
.settings(commonSettings)
// .settings(resolvers += "GitHub Package Registry" at "https://maven.pkg.github.com/hashicorp/terraform-cdk")
// .settings(credentials += Credentials("GitHub Package Registry", "maven.pkg.github.com", "mvillafuertem", ""))
.settings(libraryDependencies ++= Dependencies.`aws-cdk`)
lazy val `aws-sdk` = (project in file("modules/aws/sdk"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
// S E T T I N G S
.settings(Defaults.itSettings)
.settings(AssemblySettings.value)
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`aws-sdk`)
lazy val basic = (project in file("modules/foundations/basic"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.basic)
lazy val benchmarks = (project in file("modules/benchmarks"))
// S E T T I N G S
.settings(commonSettings)
.enablePlugins(JmhPlugin)
lazy val cask = (project in file("modules/cask"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.cask)
.settings(
dockerBaseImage := "adoptopenjdk:11-hotspot",
dockerExposedPorts := Seq(8080)
)
.enablePlugins(JavaAppPackaging)
.enablePlugins(DockerPlugin)
lazy val `akka-fsm` = (project in file("modules/akka/fsm"))
// S E T T I N G S
.settings(commonSettings)
.settings(BuildInfoSettings.value)
.settings(buildInfoPackage := s"${organization.value}.akka.fsm")
.settings(libraryDependencies ++= Dependencies.`akka-fsm`)
// P L U G I N S
.enablePlugins(BuildInfoPlugin)
.enablePlugins(GitVersioning)
lazy val `akka-http` = (project in file("modules/akka/http"))
// S E T T I N G S
.settings(commonSettings)
.settings(BuildInfoSettings.value)
.settings(buildInfoPackage := s"${organization.value}.akka.http")
.settings(libraryDependencies ++= Dependencies.`akka-http`)
// P L U G I N S
.enablePlugins(BuildInfoPlugin)
.enablePlugins(GitVersioning)
lazy val `sensor-controller` = (project in file("modules/akka/sensor-controller"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`sensor-controller`)
.settings(
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)
)
// P L U G I N S
.enablePlugins(GitVersioning)
lazy val algorithms = (project in file("modules/foundations/algorithms"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.algorithms)
lazy val `cats-calculator` = (project in file("modules/cats/calculator"))
.dependsOn(algorithms)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.cats)
lazy val `cats-console` = (project in file("modules/cats/console"))
.dependsOn(algorithms)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.cats)
lazy val `cats-semaphore` = (project in file("modules/cats/semaphore"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.cats)
lazy val docs = (project in file("modules/docs"))
.configure(WebpackSettings.browserProject)
// S E T T I N G S
.settings(commonSettingsJs)
.settings(webpackDevServerPort := 8008)
.settings(Test / requireJsDomEnv := true)
.settings(Compile / npmDependencies ++= NpmDependencies.docs)
.settings(Dependencies.docs)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
.settings(MdocSettings.value)
// P L U G I N S
.enablePlugins(ScalaJSBundlerPlugin)
.enablePlugins(MdocPlugin)
lazy val dotty = (project in file("modules/foundations/dotty"))
// S E T T I N G S
.settings(scalaVersion := Settings.scala3)
.settings(libraryDependencies ++= Dependencies.dotty)
lazy val foundations = (project in file("modules/foundations/foundations"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.foundations)
lazy val `graalvm-cli` = (project in file("modules/graalvm/cli"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`graalvm-cli`)
.settings(GraalVMSettings.value)
.enablePlugins(GraalVMNativeImagePlugin)
lazy val `grpc-account` = (project in file("modules/grpc/account"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.`grpc-account`)
.settings(ProtobufSettings.value)
.enablePlugins(Fs2Grpc)
lazy val http4s = (project in file("modules/http4s"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.http4s)
lazy val json = (project in file("modules/json"))
.dependsOn(algorithms)
// S E T T I N G S
.settings(commonSettings)
.settings(scalacOptions += "-Ymacro-annotations")
.settings(libraryDependencies ++= Dependencies.json)
lazy val reflection = (project in file("modules/foundations/reflection"))
.dependsOn(algorithms)
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.reflection)
lazy val script = (project in file("modules/script"))
// S E T T I N G S
.settings(scalaVersion := Settings.scala213)
.settings(crossScalaVersions := Seq(Settings.scala213))
.settings(libraryDependencies ++= Dependencies.script)
.settings(libraryDependencies ++= Seq("com.lihaoyi" % "ammonite" % "2.5.5" % Test cross CrossVersion.full))
.settings(commands += Commands.ammoniteCommand)
lazy val slick = (project in file("modules/slick"))
// S E T T I N G S
.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.slick)
.settings(commands += Commands.h2Command)
lazy val `scalajs-facades` = (project in file("modules/scalajs/facades"))
// S E T T I N G S
.settings(scalaVersion := Settings.scala213)
.settings(scalaJSLinkerConfig ~= { _.withSourceMap(false) })
.settings(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) })
.settings(scalaJSUseMainModuleInitializer := true)
// P L U G I N S
.enablePlugins(ScalaJSJUnitPlugin)
lazy val `scalajs-slinky` = (project in file("modules/scalajs/slinky"))
// S E T T I N G S
.settings(scalaVersion := Settings.scala213)
.settings(scalacOptions += "-Ymacro-annotations")
.settings(Dependencies.slinky)
.settings(scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) })
.settings(scalaJSLinkerConfig ~= { _.withModuleSplitStyle(ModuleSplitStyle.FewestModules) })
.settings(scalaJSLinkerConfig ~= { _.withSourceMap(false) })
.settings(scalaJSUseMainModuleInitializer := true)
.settings(externalNpm := {
Process("yarn", baseDirectory.value).!
baseDirectory.value
})
// S C A L A B L Y T Y P E D
.settings(stFlavour := Flavour.Slinky)
.settings(stMinimize := Selection.All)
.settings(stIgnore ++= List("@material-ui/icons"))
// P L U G I N S
.enablePlugins(ScalablyTypedConverterExternalNpmPlugin)
.enablePlugins(ScalaJSPlugin)
lazy val spark = (project in file("modules/spark"))
// S E T T I N G S
.settings(scalaVersion := Settings.scala212)
.settings(Settings.testReport ++ Information.value)
.settings(libraryDependencies ++= Dependencies.spark)
.settings(
Test / fork := false,
Test / parallelExecution := false
)
lazy val sttp = (project in file("modules/sttp"))
// S E T T I N G S
.settings(commonSettings)
.settings(scalacOptions += "-Ymacro-annotations")
.settings(libraryDependencies ++= Dependencies.sttp)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
lazy val tapir = (project in file("modules/tapir"))
// S E T T I N G S
.settings(commonSettings)
.settings(BuildInfoSettings.value)
.settings(libraryDependencies ++= Dependencies.tapir)
.settings(commands += Commands.h2Command)
// P L U G I N S
.enablePlugins(BuildInfoPlugin)
.enablePlugins(GitVersioning)
lazy val `terraform-cdktf-scalajs` = (project in file("modules/hashicorp/terraform-cdktf-scalajs"))
// S E T T I N G S
.settings(Information.value)
.settings(Dependencies.`terraform-cdktf-scalajs`)
// S C A L A B L Y T Y P E D
.settings(stMinimize := Selection.All)
.settings(
scalaVersion := Settings.scala213,
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
scalaJSUseMainModuleInitializer := true,
/* ScalablyTypedConverterExternalNpmPlugin requires that we define how to install node dependencies and where they are */
externalNpm := {
Process("yarn", baseDirectory.value).!
baseDirectory.value
}
)
// P L U G I N S
.enablePlugins(ScalablyTypedConverterExternalNpmPlugin)
.enablePlugins(ScalaJSPlugin)
lazy val `terraform-cdktf-scala` = (project in file("modules/hashicorp/terraform-cdktf-scala"))
// S E T T I N G S
.settings(Information.value)
.settings(scalaVersion := Settings.scala213)
.settings(libraryDependencies ++= Dependencies.`terraform-cdktf-scala`)
lazy val cdktf = taskKey[Unit]("cdktf synth")
lazy val zio: Project => Project =
// S E T T I N G S
_.settings(commonSettings)
.settings(libraryDependencies ++= Dependencies.zio)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
lazy val `zio-akka-cluster-chat` = (project in file("modules/zio/akka-cluster-chat"))
.configure(zio)
lazy val `zio-akka-cluster-sharding` = (project in file("modules/zio/akka-cluster-sharding"))
.configure(zio)
lazy val `zio-kafka` = (project in file("modules/zio/kafka"))
.configure(zio)
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
lazy val `zio-queues` = (project in file("modules/zio/queues"))
.configure(zio)
lazy val `zio-s3` = (project in file("modules/zio/s3"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-s3" % "0.4.0",
"dev.zio" %% "zio-sqs" % "0.5.0",
"com.dimafeng" %% "testcontainers-scala-core" % "0.40.11"
) ++ Seq(
"dev.zio" %% "zio-test",
"dev.zio" %% "zio-test-sbt"
).map(_ % "2.0.0" % Test)
)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
lazy val `zio-schedule` = (project in file("modules/zio/schedule"))
.configure(zio)
lazy val `zio-sqs` = (project in file("modules/zio/sqs"))
.configs(IntegrationTest)
.settings(Settings.integrationTest)
.settings(Defaults.itSettings)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-sqs" % "0.5.0",
"com.dimafeng" %% "testcontainers-scala-core" % "0.40.11"
) ++ Seq(
"dev.zio" %% "zio-test",
"dev.zio" %% "zio-test-sbt"
).map(_ % "2.0.0" % Test)
)
.settings(testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")))
lazy val `zio-streams` = (project in file("modules/zio/streams"))
.configure(zio)
def welcomeMessage: Def.Setting[String] = onLoadMessage := {
def header(text: String): String = s"${csl.BOLD}${csl.MAGENTA}$text${csl.RESET}"
def cmd(text: String, description: String = "") = f"${csl.GREEN}> ${csl.CYAN}$text%40s $description${csl.RESET}"
// def subItem(text: String): String = s" ${Console.YELLOW}> ${Console.CYAN}$text${Console.RESET}"
s"""|${header("sbt")}:
|${cmd("build", "- Prepares sources, compiles and runs tests")}
|${cmd("testOnly [package.class] -- -z [test]", "- Runs selected tests")}
|${cmd("prepare", "- Prepares sources by applying both scalafix and scalafmt")}
|${cmd("fmt", "- Formats source files using scalafmt")}
|${cmd("dependencyBrowseTree", "- It opens a browser window, but it displays a visualization of the dependency tree")}
|${cmd("""set javaOptions += "-Dconfig.file=../../local-application.conf"""", "- Set javaOptions values")}
|${cmd("show javaOptions", "- Show javaOptions values")}
|${cmd("show javaOptions", "- Show javaOptions values")}
|${cmd("""javaOptions in Test ++= Seq("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")""".stripMargin, "- Active debug mode")}
|${cmd("sbt -jvm-debug 5005".stripMargin, "- Active mode debug")}
""".stripMargin
}