-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sbt
466 lines (429 loc) · 12.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
458
459
460
461
462
463
464
465
466
import dev.hnaderi.k8s.generator.KubernetesJsonPointerGeneratorPlugin
import dev.hnaderi.k8s.generator.KubernetesScalacheckGeneratorPlugin
import sbtcrossproject.CrossProject
ThisBuild / tlBaseVersion := "0.20"
ThisBuild / organization := "dev.hnaderi"
ThisBuild / organizationName := "Hossein Naderi"
ThisBuild / startYear := Some(2022)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(
tlGitHubDev("hnaderi", "Hossein Naderi")
)
val scala212 = "2.12.20"
val scala213 = "2.13.15"
val scala3 = "3.3.3"
val PrimaryJava = JavaSpec.temurin("11")
val LTSJava = JavaSpec.temurin("17")
val supportScalaVersions = Seq(scala212, scala213, scala3)
ThisBuild / tlSonatypeUseLegacyHost := false
ThisBuild / tlSitePublishBranch := Some("main")
ThisBuild / tlJdkRelease := Some(11)
ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := supportScalaVersions
ThisBuild / githubWorkflowJavaVersions := Seq(PrimaryJava, LTSJava)
ThisBuild / githubWorkflowBuildMatrixFailFast := Some(false)
// This job is used as a sign that all build jobs have been successful and is used by mergify
ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
id = "post-build",
name = "post build",
needs = List("build"),
steps = List(
WorkflowStep.Run(
commands = List("echo success!"),
name = Some("post build")
)
),
scalas = Nil,
javas = Nil
)
ThisBuild / kubernetesVersion := "1.31.3"
ThisBuild / jsEnv := {
import org.scalajs.jsenv.nodejs.NodeJSEnv
new NodeJSEnv(NodeJSEnv.Config().withArgs(List("--max-old-space-size=6144")))
}
enablePlugins(AutomateHeaderPlugin)
lazy val root =
tlCrossRootProject
.aggregate(
objects,
objectsTest,
clientTest,
client,
javaSSL,
http4s,
http4sEmber,
http4sNetty,
http4sBlaze,
http4sJDK,
zio,
sttp,
codecTest,
circe,
`spray-json`,
`play-json`,
json4s,
`zio-json`,
jawn,
manifests,
scalacheck,
docs,
unidocs,
exampleJVM,
exampleCrossPlatform
)
.settings(
name := "scala-k8s"
)
lazy val circeVersion = "0.14.8"
lazy val munitVersion = "1.0.0-M11"
val rootDir = Def.setting((ThisBuild / baseDirectory).value)
def module(mname: String): CrossProject => CrossProject =
_.in(file(s"modules/$mname"))
.settings(
name := s"scala-k8s-$mname"
)
def example(mname: String): CrossProject => CrossProject =
_.in(file(s"examples/$mname"))
.settings(
name := s"scala-k8s-example-$mname"
)
.enablePlugins(NoPublishPlugin)
lazy val objects = module("objects") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "data models for kubernetes",
k8sUnmanagedTarget := rootDir.value / "modules" / "objects" / "src" / "main" / "scala",
buildInfoKeys := Seq[BuildInfoKey](
version,
scalaVersion,
kubernetesVersion
),
buildInfoPackage := "dev.hnaderi.k8s",
buildInfoOptions ++= Seq(BuildInfoOption.ConstantValue)
)
.enablePlugins(KubernetesObjectGeneratorPlugin, BuildInfoPlugin)
}
lazy val client = module("client") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "client core for kubernetes",
k8sUnmanagedTarget := rootDir.value / "modules" / "client" / "src" / "main" / "scala"
)
.dependsOn(objects, manifests)
.enablePlugins(KubernetesJsonPointerGeneratorPlugin)
}
lazy val javaSSL = module("java-ssl") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "java ssl for kubernetes config",
libraryDependencies ++= Seq(
"org.bouncycastle" % "bcpkix-jdk18on" % "1.79"
)
)
.dependsOn(client)
}
lazy val http4s = module("http4s") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "http4s based client for kubernetes",
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-client" % "0.23.29"
)
)
.dependsOn(client, jawn)
.jvmConfigure(_.dependsOn(javaSSL.jvm))
}
lazy val http4sEmber = module("http4s-ember") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "http4s ember based client for kubernetes",
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-ember-client" % "0.23.29"
)
)
.dependsOn(http4s)
}
lazy val http4sNetty = module("http4s-netty") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "http4s netty based client for kubernetes",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-netty-client" % "0.5.20"
)
)
.dependsOn(http4s)
}
lazy val http4sBlaze = module("http4s-blaze") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "http4s blaze based client for kubernetes",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-blaze-client" % "0.23.17"
)
)
.dependsOn(http4s)
}
lazy val http4sJDK = module("http4s-jdk") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "http4s jdk-client based client for kubernetes",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-jdk-http-client" % "0.9.2"
)
)
.dependsOn(http4s)
}
lazy val sttp = module("sttp") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "sttp based client for kubernetes",
libraryDependencies ++= Seq(
"com.softwaremill.sttp.client3" %%% "core" % "3.9.8"
)
)
.dependsOn(client, jawn)
.jvmConfigure(_.dependsOn(javaSSL.jvm))
}
lazy val zio = module("zio") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "zio-http based client for kubernetes",
libraryDependencies ++= Seq(
"dev.zio" %% "zio-http" % "3.0.0-RC4",
"dev.zio" %%% "zio-json" % "0.6.2"
)
)
.dependsOn(client, `zio-json`)
}
lazy val scalacheck = module("scalacheck") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "scalacheck generators for kubernetes data models",
k8sUnmanagedTarget := rootDir.value / "modules" / "scalacheck" / "src" / "main" / "scala",
libraryDependencies ++= Seq(
"org.scalacheck" %%% "scalacheck" % "1.17.1"
)
)
.dependsOn(objects)
.enablePlugins(KubernetesScalacheckGeneratorPlugin)
}
lazy val objectsTest = module("objects-test") {
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.settings(
description := "internal tests for scala-k8s objects",
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % munitVersion % Test
)
)
.dependsOn(objects)
.enablePlugins(NoPublishPlugin)
}
lazy val clientTest = module("client-test") {
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.settings(
description := "internal tests for scala-k8s client",
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % munitVersion % Test
)
)
.dependsOn(client)
.enablePlugins(NoPublishPlugin)
}
lazy val codecTest = module("codec-test") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
name := "scala-k8s-codec-test",
description := "internal codec tests for scala-k8s objects",
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % munitVersion,
"org.scalameta" %%% "munit-scalacheck" % munitVersion
)
)
.dependsOn(scalacheck)
.enablePlugins(NoPublishPlugin)
}
lazy val circe = module("circe") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "circe codecs for kubernetes data models",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeVersion
)
)
.dependsOn(objects)
.dependsOn(codecTest % Test)
}
lazy val `spray-json` = module("spray-json") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "spray-json codecs for kubernetes data models",
libraryDependencies ++= Seq(
"io.spray" %%% "spray-json" % "1.3.6"
)
)
.dependsOn(objects)
.dependsOn(codecTest % Test)
}
lazy val `play-json` = module("play-json") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "play-json codecs for kubernetes data models",
libraryDependencies ++= Seq(
("org.playframework" %%% "play-json" % "3.0.4")
.cross(CrossVersion.for3Use2_13)
)
)
.dependsOn(objects)
.dependsOn(codecTest % Test)
}
lazy val json4s = module("json4s") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "json4s codecs for kubernetes data models",
libraryDependencies ++= Seq(
"org.json4s" %%% "json4s-ast" % "4.0.7"
)
)
.dependsOn(objects)
.dependsOn(codecTest % Test)
}
lazy val `zio-json` = module("zio-json") {
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.settings(
description := "zio-json codecs for kubernetes data models",
libraryDependencies ++= Seq(
"dev.zio" %%% "zio-json" % "0.6.2"
)
)
.dependsOn(objects)
.dependsOn(codecTest % Test)
}
lazy val jawn = module("jawn") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "jawn facade for kubernetes data models parsing",
libraryDependencies ++= Seq(
"org.typelevel" %%% "jawn-parser" % "1.5.1"
)
)
.dependsOn(objects)
}
lazy val manifests = module("manifests") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
description := "kubernetes manifests utilities",
libraryDependencies ++= Seq(
"dev.hnaderi" %%% "yaml4s-backend" % "0.2.2"
)
)
.dependsOn(objects)
.dependsOn(codecTest % Test)
}
lazy val docs = project
.in(file("site"))
.enablePlugins(ScalaK8sWebsite)
.settings(
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-circe" % "0.23.29",
"com.softwaremill.sttp.client3" %%% "circe" % "3.10.1"
)
)
.dependsOn(http4sEmber.jvm, sttp.jvm, circe.jvm, manifests.jvm)
lazy val unidocs = project
.in(file("unidocs"))
.enablePlugins(TypelevelUnidocPlugin)
.settings(
name := "scala-k8s-docs",
description := "unified docs for scala-k8s",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(
objects.jvm,
client.jvm,
http4s.jvm,
http4sEmber.jvm,
http4sNetty.jvm,
http4sBlaze.jvm,
http4sJDK.jvm,
zio.jvm,
sttp.jvm,
circe.jvm,
`spray-json`.jvm,
`play-json`.jvm,
json4s.jvm,
`zio-json`.jvm,
jawn.jvm,
manifests.jvm,
scalacheck.jvm
)
)
lazy val exampleJVM = example("jvm") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.settings(
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-circe" % "0.23.29",
"com.softwaremill.sttp.client3" %%% "circe" % "3.10.1"
)
)
.dependsOn(http4sNetty, http4sEmber, circe, zio, sttp)
}
lazy val exampleCrossPlatform = example("cross-platform") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
libraryDependencies ++= Seq(
"org.http4s" %%% "http4s-circe" % "0.23.29"
)
)
.jsSettings(
scalaJSUseMainModuleInitializer := true,
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) },
Compile / npmDependencies ++= Seq("js-yaml" -> "4.1.0")
// scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.nativeSettings(
libraryDependencies += "com.armanbilge" %%% "epollcat" % "0.1.6",
envVars ++= Map("S2N_DONT_MLOCK" -> "1")
)
.dependsOn(http4sEmber, circe)
}
def addAlias(name: String)(tasks: String*) =
addCommandAlias(name, tasks.mkString(" ;"))
addAlias("commit")(
"reload",
"clean",
"scalafmtCheckAll",
"scalafmtSbtCheck",
"headerCheckAll",
"githubWorkflowCheck",
"+test"
)
addAlias("precommit")(
"reload",
"scalafmtAll",
"scalafmtSbt",
"headerCreateAll",
"githubWorkflowGenerate",
"+test"
)