-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.sbt
68 lines (65 loc) · 2.56 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
ThisBuild / scalaVersion := "3.3.4"
ThisBuild / crossScalaVersions := Seq((ThisBuild / scalaVersion).value, "2.13.15")
lazy val root = project.in(file("."))
.aggregate(collectionContrib.jvm, collectionContrib.js, collectionContrib.native)
.settings(
publish / skip := true,
// With CrossType.Pure, the root project also picks up the sources in `src`
Compile / unmanagedSourceDirectories := Nil,
Test / unmanagedSourceDirectories := Nil,
)
lazy val collectionContrib = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("."))
.settings(ScalaModulePlugin.scalaModuleSettings)
.settings(
name := "scala-collection-contrib",
versionPolicyIntention := Compatibility.None,
scalaModuleAutomaticModuleName := Some("scala.collection.contrib"),
Compile / compile / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(
"-Wconf:origin=scala.collection.IterableOps.toIterable:s", // internal usage; annotating @nowarn is clutter
"-Werror",
"-Wnonunit-statement",
"-Wopt",
"-opt:inline:<sources>",
"-opt:inline:scala.util.package$chaining$,scala.util.ChainingSyntax,scala.util.ChainingOps$",
"-Wvalue-discard",
"-Xlint",
"-Xsource:3-cross",
)
case _ => Seq(
"-Wconf:cat=deprecation:s", // Scala 3 lacks origin, src arrives in 3.3.4 & 3.5
"-Wconf:id=E175:s",
"-Werror",
"-Wnonunit-statement", // warns on uni-limbed if
)
}
},
Compile / doc / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq("-implicits", "-groups", "-nowarn", "-Xsource:3-cross")
case _ => Seq.empty
}
},
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-s", "-a"),
Test / parallelExecution := false, // why?
libraryDependencies ++= Seq(
"junit" % "junit" % "4.13.2" % Test,
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
),
)
.jsEnablePlugins(ScalaJSJUnitPlugin)
.jsSettings(
// Scala.js cannot run forked tests
Test / fork := false
)
.nativeEnablePlugins(ScalaNativeJUnitPlugin)
.nativeSettings(
// Scala native cannot run forked tests
Test / fork := false
)
lazy val collectionContribJVM = collectionContrib.jvm
lazy val collectionContribJS = collectionContrib.js
lazy val collectionContribNative = collectionContrib.native