-
Notifications
You must be signed in to change notification settings - Fork 98
/
build.sbt
161 lines (142 loc) · 5.5 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
import com.typesafe.tools.mima.core._
val catsVersion = "2.12.0"
val munitVersion = "1.0.2"
val munitDisciplineVersion = "2.0.0"
val scalacheckVersion = "1.18.1"
val algebraVersion = "2.12.0"
val Scala212 = "2.12.20"
val Scala213 = "2.13.15"
val Scala3 = "3.3.4"
ThisBuild / tlBaseVersion := "0.9"
ThisBuild / startYear := Some(2015)
ThisBuild / crossScalaVersions := Seq(Scala3, Scala213, Scala212)
ThisBuild / tlVersionIntroduced := Map("3" -> "0.9.3")
ThisBuild / tlFatalWarnings := false
ThisBuild / tlCiReleaseBranches := Seq("master")
ThisBuild / tlSitePublishBranch := Some("master")
ThisBuild / githubWorkflowJavaVersions := Seq("8", "21").map(JavaSpec.temurin)
ThisBuild / githubWorkflowAddedJobs +=
WorkflowJob(
"coverage",
"Coverage",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Use(UseRef.Public("actions", "setup-python", "v2"), name = Some("Setup Python")),
WorkflowStep.Run(List("pip install codecov"), name = Some("Install Codecov")),
WorkflowStep
.Sbt(List("coverage", "testsJVM/test", "testsJVM/coverageReport"), name = Some("Calculate test coverage")),
WorkflowStep.Run(List("codecov"), name = Some("Upload coverage results"))
),
scalas = List(Scala212),
javas = List(githubWorkflowJavaVersions.value.head)
)
lazy val root = tlCrossRootProject.aggregate(core, bench, scalacheck, tests, laws).settings(commonSettings)
lazy val commonJsSettings = Seq(
coverageEnabled := false,
tlVersionIntroduced ++= List("2.12", "2.13").map(_ -> "0.9.1").toMap
)
lazy val commonNativeSettings = Seq(
coverageEnabled := false,
tlVersionIntroduced ++= List("2.12", "2.13", "3").map(_ -> "0.9.9").toMap
)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(moduleName := "cats-collections-core")
.settings(dogsSettings: _*)
.settings(
mimaBinaryIssueFilters ++= {
if (tlIsScala3.value)
Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("cats.collections.PredicateInstances.$init$")
)
else Seq.empty
}
)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
lazy val scalacheck = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(moduleName := "cats-collections-scalacheck")
.settings(dogsSettings: _*)
.settings(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalacheckVersion
)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
lazy val laws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(dogsSettings: _*)
.settings(name := "cats-collections-laws")
.settings(
libraryDependencies += "org.typelevel" %%% "cats-laws" % catsVersion
)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
lazy val tests = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.enablePlugins(BuildInfoPlugin, NoPublishPlugin)
.dependsOn(scalacheck, laws)
.settings(name := "cats-collections-tests")
.settings(dogsSettings: _*)
.settings(
tlFatalWarnings := false,
coverageEnabled := false,
Test / testOptions += Tests.Argument(TestFrameworks.MUnit),
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck,
"-minSuccessfulTests",
"1000"
), // "-verbosity", "2"), // increase for stress tests
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-laws" % catsVersion % Test,
"org.typelevel" %%% "algebra-laws" % algebraVersion % Test,
"org.typelevel" %%% "discipline-munit" % munitDisciplineVersion % Test,
"org.scalameta" %%% "munit" % munitVersion % Test
),
buildInfoPackage := "cats.collections",
buildInfoKeys := Seq("isJvm" -> (crossProjectPlatform.value == JVMPlatform))
)
.jsSettings(commonJsSettings)
.nativeSettings(commonNativeSettings)
lazy val docs = project
.in(file("site"))
.enablePlugins(TypelevelSitePlugin)
.dependsOn(core.jvm)
.settings(dogsSettings: _*)
.settings(tlFatalWarnings := false)
lazy val bench = project
.settings(name := "cats-collections-bench")
.dependsOn(core.jvm)
.enablePlugins(NoPublishPlugin)
.settings(
tlFatalWarnings := false,
coverageEnabled := false,
run / fork := true,
libraryDependencies += {
val scalazV = if (tlIsScala3.value) "7.4.0-M15" else "7.3.8"
"org.scalaz" %% "scalaz-core" % scalazV
}
)
.settings(commonSettings)
.enablePlugins(JmhPlugin)
lazy val dogsSettings = commonSettings ++ scoverageSettings
lazy val commonSettings =
Seq(
headerLicense := Some(HeaderLicense.MIT("2015", "Typelevel")),
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "algebra" % algebraVersion
)
)
addCommandAlias("fmt", "; Compile / scalafmt; Test / scalafmt; scalafmtSbt")
addCommandAlias("fmtCheck", "; Compile / scalafmtCheck; Test / scalafmtCheck; scalafmtSbtCheck")
addCommandAlias("validateJVM", ";testsJVM/compile;testsJVM/test")
addCommandAlias("validateJS", ";testsJS/compile;testsJS/test")
lazy val scoverageSettings = Seq(
coverageMinimumStmtTotal := 60,
coverageFailOnMinimum := false
)
ThisBuild / developers += tlGitHubDev("anicolaspp", "Nicolas A Perez")
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"),
"BSD-3" -> url("https://opensource.org/licenses/BSD-3-Clause")
)