-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathbuild.sbt
121 lines (109 loc) · 4.26 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
val scalaVersions = Seq("2.13.15", "3.3.4")
val defaultScalaVersion = scalaVersions.head
// When defining JVM / Scala Native matrix we don't want duplicated projects for Scala 2/3
val matrixScalaVersions = Seq(defaultScalaVersion)
ThisBuild / crossScalaVersions := scalaVersions
ThisBuild / scalaVersion := defaultScalaVersion
Global / concurrentRestrictions += Tags.limit(NativeTags.Link, 1)
Global / cancelable := true
publish / skip := true // in root
lazy val commonSettings: Seq[Setting[_]] =
Seq(scalaModuleAutomaticModuleName := Some("scala.collection.parallel")) ++
ScalaModulePlugin.scalaModuleSettings ++ Seq(
versionPolicyIntention := Compatibility.BinaryCompatible,
crossScalaVersions := scalaVersions,
Compile / compile / scalacOptions --= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq("-Xlint")
case _ => Seq()
}),
Compile / compile / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq()
case _ => Seq("-Werror"),
}),
)
lazy val testNativeSettings: Seq[Setting[_]] = Seq(
// Required by Scala Native testing infrastructure
Test / fork := false,
)
lazy val core = projectMatrix.in(file("core"))
.settings(commonSettings)
.settings(
name := "scala-parallel-collections",
Compile / doc / autoAPIMappings := true,
)
.jvmPlatform(matrixScalaVersions)
.nativePlatform(matrixScalaVersions, settings = testNativeSettings ++ Seq(
versionPolicyPreviousArtifacts := Nil, // TODO: not yet published
mimaPreviousArtifacts := Set.empty
))
lazy val junit = projectMatrix.in(file("junit"))
.settings(commonSettings)
.settings(
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
publish / skip := true,
).dependsOn(testmacros, core)
.jvmPlatform(matrixScalaVersions,
settings = Seq(
libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.3" % Test,
libraryDependencies += "junit" % "junit" % "4.13.2" % Test,
// for javax.xml.bind.DatatypeConverter, used in SerializationStabilityTest
libraryDependencies += "javax.xml.bind" % "jaxb-api" % "2.3.1" % Test,
Test / fork := true,
)
)
.nativePlatform(matrixScalaVersions,
axisValues = Nil,
configure = _
.enablePlugins(ScalaNativeJUnitPlugin)
.settings(
Test/unmanagedSources/excludeFilter ~= { _ ||
"SerializationTest.scala" || // requires ObjectOutputStream
"SerializationStability.scala" || // requires jaxb-api
"SerializationStabilityBase.scala" ||
"SerializationStabilityTest.scala"
},
Test / fork := false
)
)
lazy val scalacheck = projectMatrix.in(file("scalacheck"))
.settings(commonSettings)
.settings(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.18.1",
Test / testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-workers", "1", "-minSize", "0", "-maxSize", "4000", "-minSuccessfulTests", "5"),
publish / skip := true
)
.dependsOn(core)
.jvmPlatform(matrixScalaVersions,
settings = Seq(
Test / fork := true
)
)
.nativePlatform(matrixScalaVersions, settings = testNativeSettings)
lazy val testmacros = projectMatrix.in(file("testmacros"))
.settings(commonSettings)
.settings(
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Nil
case _ => List(scalaOrganization.value % "scala-compiler" % scalaVersion.value)
}),
publish / skip := true,
)
.jvmPlatform(matrixScalaVersions)
.nativePlatform(matrixScalaVersions, settings = testNativeSettings)
commands += Command.single("setScalaVersion") { (state, arg) =>
val command = arg match {
case "3.next" => s"++${GetScala3Next.get()}!"
case _ => s"++$arg"
}
command :: state
}
import sbt.internal.{ProjectMatrix, ProjectFinder}
def testPlatformCommand(name: String, selector: ProjectMatrix => ProjectFinder): Command =
Command.command(name) { state =>
List(junit, scalacheck, testmacros)
.flatMap(selector(_).get)
.map{ project => s"${project.id}/test"}
.toList ::: state
}
commands += testPlatformCommand("testNative", _.native)
commands += testPlatformCommand("testJVM", _.jvm)