-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
88 lines (83 loc) · 2.99 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
import Dependencies._
/* Core settings */
val orgName = "at.ac.oeaw.imba.gerlich"
val projectName = "looptrace"
val rootPkg = s"$orgName.$projectName"
val primaryJavaVersion = "11"
val primaryOs = "ubuntu-latest"
val isPrimaryOsAndPrimaryJavaTest = s"runner.os == '$primaryOs' && runner.java-version == '$primaryJavaVersion'"
ThisBuild / scalaVersion := "3.5.2"
ThisBuild / version := "0.11.0"
ThisBuild / organization := orgName
ThisBuild / organizationName := "Gerlich Group, IMBA, OEAW"
// Needed for ZARR (jzarr) (?)
ThisBuild / resolvers += "Unidata UCAR" at "https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases/"
/* sbt-github-actions settings */
ThisBuild / githubWorkflowOSes := Seq(primaryOs, "ubuntu-20.04", "macos-latest")
ThisBuild / githubWorkflowTargetBranches := Seq("main")
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
ThisBuild / githubWorkflowJavaVersions := Seq(primaryJavaVersion, "17", "19", "21").map(JavaSpec.temurin)
ThisBuild / githubWorkflowBuildPreamble ++= Seq(
// Account for the absence of sbt in newer versions of the setup-java GitHub Action.
WorkflowStep.Run(commands = List("brew install sbt"), cond = Some("contains(runner.os, 'macos')")),
/* Add linting and formatting checks, but only limit to a single platform + Java combo. */
WorkflowStep.Sbt(
List("scalafmtCheckAll"),
name = Some("Check formatting with scalafmt"),
cond = Some(isPrimaryOsAndPrimaryJavaTest),
),
WorkflowStep.Sbt(
List("scalafixAll --check"),
name = Some("Lint with scalafix"),
cond = Some(isPrimaryOsAndPrimaryJavaTest),
),
)
ThisBuild / assemblyMergeStrategy := {
// This works for the moment, but seems dangerous; what if we really needed what was in here?
// Conflict comes from logback-classic + logback-core, each having module-info.class.
case "module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
oldStrategy(x)
}
lazy val root = (project in file("."))
.enablePlugins(BuildInfoPlugin)
.settings(
name := projectName,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := s"$rootPkg.internal",
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "utf8",
//"-explain",
"-feature",
"-language:existentials",
// https://contributors.scala-lang.org/t/for-comprehension-requires-withfilter-to-destructure-tuples/5953
"-source:future", // for tuples in for comprehension; see above link
"-unchecked",
"-Werror",
),
libraryDependencies ++= Seq(
catsCore,
iron,
ironCats,
mouse,
os,
pureconfigCore,
pureconfigGeneric,
scopt,
squants,
uPickle,
) ++
gerlibs ++
logging ++
Seq( // only for tests
gerlibTesting,
ironScalacheck,
scalaCsv,
scalacheck,
scalactic,
scalatest,
scalatestScalacheck
).map(_ % Test),
)