-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sbt
More file actions
415 lines (378 loc) · 17.4 KB
/
Copy pathbuild.sbt
File metadata and controls
415 lines (378 loc) · 17.4 KB
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
import commandmatrix.extra.*
import kubuszok.sbt._
import kubuszok.sbt.KubuszokPlugin.autoImport._
// Versions
//
// Defined as a top-level object in project/Versions.scala (not an anonymous `new { ... }`
// refinement here) because the sbt-2.0 Scala-3 build dialect drops the structural members of an
// anonymous refinement, breaking `versions.X` field access.
val versions = Versions
val dev = new DevProperties(
scala213 = None,
scala3 = Some(versions.scala3),
platforms = versions.platforms
)
lazy val al = new Aliases(
published = Seq(
`ssg-commons`,
`ssg-data-commons`,
`ssg-graphs-commons`,
`ssg-graphviz`,
`ssg-highlight`,
`ssg-js`,
`ssg-katex`,
`ssg-liquid`,
`ssg-md`,
`ssg-mermaid`,
`ssg-minify`,
`ssg-sass`,
`ssg-site`
),
compileOnly = Seq(
ssg
)
)
val commonSettings = Seq(
MatrixAction.ForAll.Configure(_.settings(
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-no-indent",
"-Werror",
"-Wimplausible-patterns",
"-Wrecurse-with-default",
"-Wenum-comment-discard",
"-Wunused:imports,privates,locals,patvars,nowarn",
// ISS-1354: raise the kindlings-yaml derivation macro timeout (default 5s) so
// KindlingsYamlDecoder.fromYamlString[DataView] doesn't intermittently time out on
// slow CI runners (macos-x86_64). kindlings-yaml reads this from -Xmacro-settings.
"-Xmacro-settings:yamlDerivation.timeout=30s"
),
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % versions.munit % Test,
"org.scalameta" %% "munit-scalacheck" % versions.munitScalacheck % Test
),
resolvers += Resolver.mavenLocal,
// Sonatype Central Portal snapshots — hearth/kindlings sbt-2.0 dev snapshots
// (the incoming hearth 0.4.0 / kindlings 0.3.0 breaking-change line) live here,
// published by their CI; not yet released to Central.
resolvers += "Central Portal Snapshots" at "https://central.sonatype.com/repository/maven-snapshots/",
testFrameworks += new TestFramework("munit.Framework")
)),
MatrixAction.ForPlatforms(VirtualAxis.jvm).Configure(_.settings(
fork := true,
// Enable native access for the Foreign Function & Memory API (JEP 454),
// used by NativeMathPlatform to call the native C pow() for exact
// floating-point parity with dart-sass / JavaScript Math.pow.
javaOptions += "--enable-native-access=ALL-UNNAMED",
// scoverage's runtime Invoker (forked test JVM) appends measurement files to
// crossTarget/scoverage-data, but under sbt-2.0's target/out layout scoverage
// does not create that dir at instrumentation time, so the first write throws
// FileNotFoundException mid-test (only when `coverage` is on, i.e. ci-jvm-3).
// Pre-create it before the test tasks (a no-op empty dir when coverage is off).
// Handoff recipe: "scoverage Test/compile dir pre-create" → Def.uncached.
// Only testFull needs it: coverage runs via ci-jvm-3 → testFull (sbt-2.0's
// bare `test` is an InputTask and is not used by CI).
Test / testFull := (Test / testFull).dependsOn(Def.uncached(Def.task {
IO.createDirectory(crossTarget.value / "scoverage-data")
})).value
)),
MatrixAction.ForPlatforms(VirtualAxis.native).Configure(_.settings(
scalanative.sbtplugin.ScalaNativePlugin.autoImport.nativeConfig ~= {
_.withEmbedResources(true).withMultithreading(false) // Single-threaded: avoids thread stack limits, uses main stack
},
// scalacheck 1.19 pulls test-interface 0.5.8 while scala-native 0.5.12 selects 0.5.8's successor
// 0.5.12 (strict): the two are compatible at the test-interface level, so downgrade the eviction
// conflict from an error to a warning on the native axis.
evictionErrorLevel := Level.Warn
))
)
val publishSettings = Seq(
organization := "com.kubuszok",
homepage := Some(url("https://github.com/kubuszok/ssg")),
organizationHomepage := Some(url("https://kubuszok.com")),
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")),
scmInfo := Some(
ScmInfo(
url("https://github.com/kubuszok/ssg/"),
"scm:git:git@github.com:kubuszok/ssg.git"
)
),
startYear := Some(2026),
developers := List(
Developer("MateuszKubuszok", "Mateusz Kubuszok", "", url("https://kubuszok.com"))
),
pomExtra := (
<issueManagement>
<system>GitHub issues</system>
<url>https://github.com/kubuszok/ssg/issues</url>
</issueManagement>
),
projectType := ProjectType.ScalaLibrary
)
val noPublishSettings =
Seq(projectType := ProjectType.NonPublished)
val mimaSettings = Seq(
mimaPreviousArtifacts := Set(),
mimaFailOnNoPrevious := false
)
// --- Common utilities (cross-platform abstractions) ---
lazy val `ssg-commons` = (projectMatrix in file("ssg-commons"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-commons",
libraryDependencies ++= Seq(
"com.kubuszok" %% "lls" % versions.lls,
)
)
.settings(publishSettings)
.settings(mimaSettings)
// --- Data view abstractions (shared) ---
lazy val `ssg-data-commons` = (projectMatrix in file("ssg-data-commons"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-data-commons",
libraryDependencies ++= Seq(
"com.kubuszok" %% "hearth" % versions.hearth,
"io.github.cquiroz" %% "scala-java-time" % versions.scalaJavaTime
),
libraryDependencies += compilerPlugin("com.kubuszok" %% "hearth-cross-quotes" % versions.hearth)
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- Graph layout and SVG infrastructure (shared) ---
lazy val `ssg-graphs-commons` = (projectMatrix in file("ssg-graphs-commons"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-graphs-commons"
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- Graphviz DOT renderer ---
lazy val `ssg-graphviz` = (projectMatrix in file("ssg-graphviz"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-graphviz"
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`, `ssg-graphs-commons`)
// --- Syntax highlighting (tree-sitter) ---
lazy val `ssg-highlight` = (projectMatrix in file("ssg-highlight"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE ++ Seq(
MatrixAction.ForPlatforms(VirtualAxis.jvm).Configure(_.settings(
libraryDependencies ++= Seq(
"com.kubuszok" % "pnm-provider-tree-sitter-desktop" % versions.treeSitterProviders,
"com.kubuszok" %% "multiarch-core" % versions.multiarch
)
)),
MatrixAction.ForPlatforms(VirtualAxis.js).Configure(_.settings(
libraryDependencies += "com.kubuszok" % "wasm-provider-tree-sitter" % versions.treeSitterProviders,
scalaJSLinkerConfig ~= { _.withModuleKind(org.scalajs.linker.interface.ModuleKind.CommonJSModule) },
// sbt 2.0 result caching has no sjsonnew.HashWriter for JSEnv → opt out with Def.uncached.
Test / jsEnv := Def.uncached(new org.scalajs.jsenv.nodejs.NodeJSEnv(
org.scalajs.jsenv.nodejs.NodeJSEnv.Config()
.withEnv(Map("TREE_SITTER_WASM_DIR" -> sys.env.getOrElse("TREE_SITTER_WASM_DIR", "/tmp/ts-wasm")))
))
)),
// TODO: check if _root_.multiarch.sbt.NativeProviderPlugin.projectSettings is necessary for this to work
MatrixAction.ForPlatforms(VirtualAxis.native).Configure(_.settings(
(_root_.multiarch.sbt.NativeProviderPlugin.projectSettings ++ Seq(
libraryDependencies += "com.kubuszok" % "sn-provider-tree-sitter" % versions.treeSitterProviders,
scalanative.sbtplugin.ScalaNativePlugin.autoImport.nativeConfig ~= {
_.withResourceIncludePatterns(Seq("**.scm"))
}
)) *
))
)) *)
.settings(
name := "ssg-highlight",
libraryDependencies ++= Seq(
"com.kubuszok" % "tree-sitter-queries" % versions.treeSitterProviders
)
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`, `ssg-md`)
// --- JavaScript compiler/minifier (Terser port) ---
lazy val `ssg-js` = (projectMatrix in file("ssg-js"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-js",
// The Terser port's name mangler keeps process-global mutable state (object Base54's char/frequency
// table — terser's lib/scope.js Base54 is a single module-level singleton, reset per minify call).
// sbt 2.0 runs test suites in parallel within one forked JVM by default, so concurrent minify calls
// race on that shared state and produce nondeterministic mangled names. Run ssg-js tests serially to
// preserve the single-threaded contract (matches sbt 1.x behavior).
Test / parallelExecution := false
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- Math typesetting (KaTeX port) ---
lazy val `ssg-katex` = (projectMatrix in file("ssg-katex"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-katex",
// ISS-1348: The KaTeX port's macro registry (Macros.registerAll) populates a process-global
// mutable map. Parallel test suites race on that shared state. Run ssg-katex tests serially
// to preserve the single-threaded contract (same pattern as ssg-js / Base54).
Test / parallelExecution := false
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- Liquid template engine (liqp port) ---
lazy val `ssg-liquid` = (projectMatrix in file("ssg-liquid"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE ++ Seq(
MatrixAction.ForPlatforms(VirtualAxis.js).Configure(_.settings(
libraryDependencies += "io.github.cquiroz" %% "scala-java-time-tzdb" % versions.scalaJavaTime
)),
MatrixAction.ForPlatforms(VirtualAxis.native).Configure(_.settings(
libraryDependencies += "io.github.cquiroz" %% "scala-java-time-tzdb" % versions.scalaJavaTime
))
)) *)
.settings(
name := "ssg-liquid",
libraryDependencies ++= Seq(
"io.github.cquiroz" %% "scala-java-time" % versions.scalaJavaTime,
"io.github.cquiroz" %% "scala-java-locales" % versions.scalaJavaLocales
)
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`, `ssg-data-commons`)
// --- Markdown engine (flexmark-java port) ---
// Scala.js has no classpath, so Class.getResourceAsStream cannot resolve runtime resources. The shared
// multiarch-resources mechanism embeds ssg-md's main resources at build time into a self-registering
// generated object (ssg.md.util.misc.GeneratedEmbeddedResources) which the runtime
// multiarch.resources.PlatformResourcesImpl (scalajs) consults first, falling back to a Node fs lookup
// for in-repo development. ssg.md.util.misc.PlatformResources is a thin boundary shim that delegates to
// the shared API and converts Option -> Nullable (ISS-979).
lazy val `ssg-md` = (projectMatrix in file("ssg-md"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE ++ Seq(
MatrixAction.ForPlatforms(VirtualAxis.js).Configure(_.settings(
_root_.multiarch.sbt.MultiArchResourcesPlugin.embeddedResourcesSettings(
objectName = "ssg.md.util.misc.GeneratedEmbeddedResources"
)
))
)) *)
.settings(
name := "ssg-md",
libraryDependencies += "com.kubuszok" %% "multiarch-resources" % versions.multiarch
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- Diagramming engine (Mermaid port) ---
lazy val `ssg-mermaid` = (projectMatrix in file("ssg-mermaid"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE ++ Seq(
MatrixAction.ForPlatforms(VirtualAxis.js).Configure(_.settings(
libraryDependencies += "io.github.cquiroz" %% "scala-java-time-tzdb" % versions.scalaJavaTime
)),
MatrixAction.ForPlatforms(VirtualAxis.native).Configure(_.settings(
libraryDependencies += "io.github.cquiroz" %% "scala-java-time-tzdb" % versions.scalaJavaTime
))
)) *)
.settings(
name := "ssg-mermaid",
libraryDependencies ++= Seq(
"io.github.cquiroz" %% "scala-java-time" % versions.scalaJavaTime,
"com.kubuszok" %% "kindlings-yaml-derivation" % versions.kindlingsYaml
)
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`, `ssg-data-commons`, `ssg-graphs-commons`)
// --- Web asset minification (jekyll-minifier port) ---
lazy val `ssg-minify` = (projectMatrix in file("ssg-minify"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-minify"
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- SASS/SCSS compiler (dart-sass port) ---
lazy val `ssg-sass` = (projectMatrix in file("ssg-sass"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-sass"
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`)
// --- Site pipeline (SSG-native glue) ---
lazy val `ssg-site` = (projectMatrix in file("ssg-site"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg-site",
libraryDependencies += "com.kubuszok" %% "kindlings-yaml-derivation" % versions.kindlingsYaml,
// ISS-1353: the SiteBuildPhase suites each run a full site build (SASS compile + file writes);
// run them serially so concurrent filesystem access can't race — intermittent IOException on
// Native-Windows only, where file locking is strict (POSIX tolerates it). Mirrors ssg-js/ssg-katex.
Test / parallelExecution := false
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`, `ssg-data-commons`, `ssg-js`, `ssg-liquid`, `ssg-md`, `ssg-minify`, `ssg-sass`)
// --- Aggregator module ---
lazy val ssg = (projectMatrix in file("ssg"))
.defaultAxes(VirtualAxis.jvm, VirtualAxis.scalaABIVersion(versions.scala3))
.someVariations(versions.scalas, versions.platforms)((commonSettings ++ dev.only1VersionInIDE) *)
.settings(
name := "ssg"
)
.settings(publishSettings)
.settings(mimaSettings)
.dependsOn(`ssg-commons`, `ssg-data-commons`, `ssg-graphs-commons`, `ssg-graphviz`, `ssg-highlight`, `ssg-js`, `ssg-katex`, `ssg-liquid`, `ssg-md`, `ssg-mermaid`, `ssg-minify`, `ssg-sass`, `ssg-site`)
// ── Root project (aggregation + CI aliases) ──────────────────────────
//
// sbt-welcome has no sbt-2.0 build and is no longer bundled by sbt-kubuszok, so the `logo` /
// `usefulTasks` wiring (which also registered the ci-*/test-* aliases on the sbt-1.x axis) is gone.
// We register the CI aliases ourselves via addCommandAlias, reusing Aliases.ci(...) to assemble each
// pipeline's task list. On sbt 2.0 the bare `test` task is incrementally cached and runs 0 suites on a
// fresh checkout (silent false-green), so we rewrite every `<id>/test` task to `<id>/testFull`.
def ciTestFull(platform: String, scalaBinary: String): String =
al.ci(platform, scalaBinary).replaceAll("""/test(?=( ; )|$)""", "/testFull")
lazy val root = (project in file("."))
.enablePlugins(KubuszokRootPlugin)
.settings(
name := "ssg-root"
)
.settings(
addCommandAlias("ci-jvm-3", ciTestFull("JVM", "3")),
addCommandAlias("ci-js-3", ciTestFull("JS", "3")),
addCommandAlias("ci-native-3", ciTestFull("Native", "3"))
)
.aggregate(`ssg-commons`.projectRefs *)
.aggregate(`ssg-data-commons`.projectRefs *)
.aggregate(`ssg-graphs-commons`.projectRefs *)
.aggregate(`ssg-graphviz`.projectRefs *)
.aggregate(`ssg-highlight`.projectRefs *)
.aggregate(`ssg-js`.projectRefs *)
.aggregate(`ssg-katex`.projectRefs *)
.aggregate(`ssg-liquid`.projectRefs *)
.aggregate(`ssg-md`.projectRefs *)
.aggregate(`ssg-mermaid`.projectRefs *)
.aggregate(`ssg-minify`.projectRefs *)
.aggregate(`ssg-sass`.projectRefs *)
.aggregate(`ssg-site`.projectRefs *)
.aggregate(ssg.projectRefs *)
.settings(noPublishSettings)
.settings(mimaSettings)