forked from typelevel/cats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
327 lines (287 loc) · 10.8 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
ThisBuild / tlBaseVersion := "2.10"
val scalaCheckVersion = "1.17.0"
val disciplineVersion = "1.5.1"
val disciplineMunitVersion = "2.0.0-M3"
val munitVersion = "1.0.0-M7"
val kindProjectorVersion = "0.13.2"
val PrimaryJava = JavaSpec.temurin("8")
val LTSJava = JavaSpec.temurin("17")
val GraalVM11 = JavaSpec.graalvm("11")
ThisBuild / githubWorkflowJavaVersions := Seq(PrimaryJava, LTSJava, GraalVM11)
val Scala212 = "2.12.17"
val Scala213 = "2.13.10"
val Scala3 = "3.2.1"
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213, Scala3)
ThisBuild / scalaVersion := Scala213
ThisBuild / tlFatalWarnings := false
ThisBuild / tlFatalWarningsInCi := false
ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"scalafix",
"Scalafix",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Run(List("cd scalafix", "sbt test"), name = Some("Scalafix tests"))
),
javas = List(PrimaryJava),
scalas = List((ThisBuild / scalaVersion).value)
)
)
lazy val macroSettings = Seq(
libraryDependencies ++= {
if (tlIsScala3.value)
Nil
else
Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided)
}
)
lazy val cats1BincompatSettings = Seq(
tlMimaPreviousVersions ++= {
if (scalaVersion.value.startsWith("2.12")) Set("1.0.1", "1.1.0", "1.2.0", "1.3.1", "1.4.0", "1.5.0", "1.6.1")
else Set.empty
}
)
ThisBuild / tlVersionIntroduced := Map("3" -> "2.6.1")
lazy val commonJvmSettings = Seq(
Test / fork := true,
Test / javaOptions := Seq("-Xmx3G"),
doctestGenTests := { if (tlIsScala3.value) Nil else doctestGenTests.value }
)
lazy val commonJsSettings = Seq(
doctestGenTests := Seq.empty,
tlVersionIntroduced ++= List("2.12", "2.13").map(_ -> "2.1.0").toMap
)
lazy val commonNativeSettings = Seq(
doctestGenTests := Seq.empty,
tlVersionIntroduced ++= List("2.12", "2.13").map(_ -> "2.4.0").toMap + ("3" -> "2.8.0")
)
lazy val disciplineDependencies = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %%% "discipline-core" % disciplineVersion
)
)
lazy val testingDependencies = Seq(
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % munitVersion % Test,
"org.typelevel" %%% "discipline-munit" % disciplineMunitVersion % Test
)
)
lazy val root = tlCrossRootProject
.aggregate(
kernel,
kernelLaws,
algebra,
algebraLaws,
core,
laws,
free,
testkit,
tests,
alleycatsCore,
alleycatsLaws,
alleycatsTests,
unidocs,
bench,
binCompatTest
)
lazy val kernel = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("kernel"))
.settings(moduleName := "cats-kernel", name := "Cats kernel")
.settings(testingDependencies)
.settings(Compile / sourceGenerators += (Compile / sourceManaged).map(KernelBoiler.gen).taskValue)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings, cats1BincompatSettings)
.nativeSettings(commonNativeSettings)
lazy val kernelLaws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("kernel-laws"))
.dependsOn(kernel)
.settings(moduleName := "cats-kernel-laws", name := "Cats kernel laws")
.settings(disciplineDependencies)
.settings(testingDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val algebraSettings = Seq[Setting[_]](
tlMimaPreviousVersions += "2.2.3",
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "2.7.0").toMap
)
lazy val algebraNativeSettings = Seq[Setting[_]](
tlMimaPreviousVersions ~= (_ - "2.2.3"),
tlVersionIntroduced += ("3" -> "2.8.0")
)
lazy val algebra = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("algebra-core"))
.dependsOn(kernel)
.settings(moduleName := "algebra", name := "Cats algebra")
.settings(Compile / sourceGenerators += (Compile / sourceManaged).map(AlgebraBoilerplate.gen).taskValue)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
.settings(
algebraSettings,
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test,
testingDependencies
)
.nativeSettings(algebraNativeSettings)
lazy val algebraLaws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("algebra-laws"))
.dependsOn(kernelLaws, algebra)
.settings(moduleName := "algebra-laws", name := "Cats algebra laws")
.settings(disciplineDependencies)
.settings(testingDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
.settings(algebraSettings)
.nativeSettings(algebraNativeSettings)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(kernel)
.settings(moduleName := "cats-core", name := "Cats core")
.settings(macroSettings)
.settings(Compile / sourceGenerators += (Compile / sourceManaged).map(Boilerplate.gen).taskValue)
.settings(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test,
Compile / doc / scalacOptions ~= { _.filterNot(_.startsWith("-W")) } // weird bug
)
.settings(testingDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings, cats1BincompatSettings)
.nativeSettings(commonNativeSettings)
lazy val laws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(kernel, core, kernelLaws)
.settings(moduleName := "cats-laws", name := "Cats laws")
.settings(disciplineDependencies)
.settings(testingDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val free = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core, tests % "test-internal -> test")
.settings(moduleName := "cats-free", name := "Cats Free")
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings, cats1BincompatSettings)
.nativeSettings(commonNativeSettings)
lazy val tests = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.dependsOn(testkit % Test)
.enablePlugins(NoPublishPlugin)
.settings(moduleName := "cats-tests")
.settings(testingDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val testkit = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core, laws)
.enablePlugins(BuildInfoPlugin)
.settings(buildInfoKeys := Seq[BuildInfoKey](scalaVersion), buildInfoPackage := "cats.tests")
.settings(moduleName := "cats-testkit")
.settings(disciplineDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val alleycatsCore = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("alleycats-core"))
.dependsOn(core)
.settings(moduleName := "alleycats-core", name := "Alleycats core")
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val alleycatsLaws = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("alleycats-laws"))
.dependsOn(alleycatsCore, laws)
.settings(moduleName := "alleycats-laws", name := "Alleycats laws")
.settings(disciplineDependencies)
.settings(testingDependencies)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val alleycatsTests = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("alleycats-tests"))
.dependsOn(alleycatsLaws, tests % "test-internal -> test")
.enablePlugins(NoPublishPlugin)
.settings(moduleName := "alleycats-tests")
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.nativeSettings(commonNativeSettings)
lazy val unidocs = project
.enablePlugins(TypelevelUnidocPlugin)
.settings(
name := "cats-docs",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(kernel.jvm,
kernelLaws.jvm,
core.jvm,
laws.jvm,
free.jvm,
algebra.jvm,
algebraLaws.jvm,
alleycatsCore.jvm,
alleycatsLaws.jvm,
testkit.jvm
),
scalacOptions ~= { _.filterNot(_.startsWith("-W")) }, // weird nsc bug
ScalaUnidoc / unidoc / scalacOptions ++= Seq("-groups", "-diagrams")
)
// bench is currently JVM-only
lazy val bench = project
.dependsOn(core.jvm, free.jvm, laws.jvm)
.settings(moduleName := "cats-bench")
.settings(commonJvmSettings)
.settings(
evictionErrorLevel := Level.Warn
)
.enablePlugins(NoPublishPlugin, JmhPlugin)
lazy val binCompatTest = project
.enablePlugins(NoPublishPlugin)
.settings(
useCoursier := false, // workaround so we can use an old version in compile
libraryDependencies += {
val oldV = if (tlIsScala3.value) "2.6.1" else "2.0.0"
"org.typelevel" %%% "cats-core" % oldV % Provided
}
)
.settings(testingDependencies)
.dependsOn(core.jvm % Test)
lazy val docs = project
.in(file("site"))
.enablePlugins(TypelevelSitePlugin)
.settings(
tlFatalWarnings := false,
laikaConfig ~= { _.withRawContent },
tlSiteRelatedProjects := Seq(
TypelevelProject.CatsEffect,
"Mouse" -> url("https://typelevel.org/mouse"),
TypelevelProject.Discipline
),
libraryDependencies ++= Seq(
"org.typelevel" %%% "discipline-munit" % disciplineMunitVersion
)
)
.dependsOn(core.jvm, free.jvm, laws.jvm)
ThisBuild / licenses := List(License.MIT)
ThisBuild / startYear := Some(2015)
ThisBuild / developers ++= List(
tlGitHubDev("ceedubs", "Cody Allen"),
tlGitHubDev("rossabaker", "Ross Baker"),
tlGitHubDev("armanbilge", "Arman Bilge"),
tlGitHubDev("johnynek", "P. Oscar Boykin"),
tlGitHubDev("travisbrown", "Travis Brown"),
tlGitHubDev("adelbertc", "Adelbert Chang"),
tlGitHubDev("danicheg", "Daniel Esik"),
tlGitHubDev("peterneyens", "Peter Neyens"),
tlGitHubDev("tpolecat", "Rob Norris"),
tlGitHubDev("non", "Erik Osheim"),
tlGitHubDev("LukaJCB", "LukaJCB"),
tlGitHubDev("mpilquist", "Michael Pilquist"),
tlGitHubDev("milessabin", "Miles Sabin"),
tlGitHubDev("djspiewak", "Daniel Spiewak"),
tlGitHubDev("fthomas", "Frank Thomas"),
tlGitHubDev("satorg", "Sergey Torgashov"),
tlGitHubDev("julien-truffaut", "Julien Truffaut"),
tlGitHubDev("kailuowang", "Kailuo Wang")
)