-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sbt
More file actions
85 lines (71 loc) · 3.59 KB
/
Copy pathbuild.sbt
File metadata and controls
85 lines (71 loc) · 3.59 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
import Versions.*
ThisBuild / version := vCcas
ThisBuild / scalaVersion := vScala
ThisBuild / sbtVersion := vSbt
// modules
libraryDependencies ++= Seq(
// zio
"dev.zio" %% "zio" % vZio,
"dev.zio" %% "zio-test" % vZio % Test,
"dev.zio" %% "zio-test-sbt" % vZio % Test,
"dev.zio" %% "zio-test-magnolia" % vZio % Test,
// zio-json
"dev.zio" %% "zio-json" % vZioJson,
// zio-config
"dev.zio" %% "zio-config" % vZioConfig,
"dev.zio" %% "zio-config-magnolia" % vZioConfig,
"dev.zio" %% "zio-config-typesafe" % vZioConfig,
// zio-http
"dev.zio" %% "zio-http" % vZioHttp,
// magnum
"com.augustnagro" %% "magnum" % vMagnum,
// postgresql
"org.postgresql" % "postgresql" % vPostgresql,
// connection pool
"com.zaxxer" % "HikariCP" % vHikari,
// ulid
"com.github.f4b6a3" % "ulid-creator" % vUlidCreator,
// zio-cli (CLI parsing — ZIO-native, also generates shell completions)
"dev.zio" %% "zio-cli" % vZioCli,
// No-op SLF4J binding: we log via ZIO, not SLF4J. Without a binding, transitive SLF4J users (netty, etc.) print
// "No SLF4J providers were found" on every CLI invocation; the NOP binding silences that library noise.
"org.slf4j" % "slf4j-nop" % vSlf4j
)
scalacOptions ++= Seq(
"--deprecation",
"--feature",
"-Wunused:all",
"-Wshadow:all",
"-Wvalue-discard",
"-Xmax-inlines:64"
)
// Suites run one-at-a-time. The test suite shares three process-global resources that concurrent suites race on:
// the OS process table / memory (the `<shell> -n` completion checks spawn subprocesses that fail to fork under
// parallel-suite memory pressure), the JVM's `System.out` (TestProgressBar swaps it process-wide to capture output),
// and — historically — DB rows (now isolated per-suite via FreshSchemaLayer). Disabling cross-suite parallelism
// removes the contention at its root rather than masking it with `@@ TestAspect.flaky` retries. Cost is small: the
// suite is DB-I/O-bound, so serialising adds ~11s to the test phase (~17s -> ~28s), not a multiple. Tracked: #65.
Test / parallelExecution := false
lazy val root = (project in file("."))
.enablePlugins(BuildInfoPlugin, JavaAppPackaging)
.settings(
name := "ccas",
// `sbt stage` emits two launchers: `bin/ccas` (primary, the CLI) and a forwarder
// `bin/ccas-server` for the deployable server entry. Pin discoveredMainClasses so
// native-packager only forwards CcasServer, not every ZIOAppDefault app.
Compile / mainClass := Some("ccas.cli.Main"),
executableScriptName := "ccas",
Compile / discoveredMainClasses := Seq("ccas.cli.Main", "ccas.server.CcasServer"),
buildInfoKeys := Seq(name, version, scalaVersion, sbtVersion),
buildInfoPackage := "ccas.info",
// Silence the sun.misc.Unsafe deprecation warning (scala-library's LazyVals) that the JVM
// prints on JDK 24+. The `--sun-misc-unsafe-memory-access` flag only exists on JDK 23+, so
// probe the runtime version in the launcher and add it conditionally (older JDKs don't warn).
bashScriptExtraDefines ++= Seq(
// Grant native access to unnamed-module code (netty's loadLibrary) so the JVM doesn't print "restricted method"
// warnings on JDK 24+. Valid since JDK 16 and harmless on older JDKs, so add it unconditionally.
"addJava \"--enable-native-access=ALL-UNNAMED\"",
"""java_major=$("${java_cmd:-java}" -version 2>&1 | head -n1 | sed -E 's/.*version "?([0-9]+).*/\1/')""",
"""if [ "${java_major:-0}" -ge 23 ] 2>/dev/null; then addJava "--sun-misc-unsafe-memory-access=allow"; fi"""
)
)