-
Notifications
You must be signed in to change notification settings - Fork 126
/
build.sbt
200 lines (186 loc) · 5.06 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
import sbtcrossproject.CrossProject
import sbtcrossproject.CrossType
lazy val munitVersion = "1.0.2"
lazy val scalametaVersion = "4.9.9"
lazy val defaultScala212 = "2.12.20"
lazy val defaultScala213 = "2.13.15"
lazy val defaultScala3 = "3.3.0"
lazy val bin212 =
Seq(
defaultScala212,
"2.12.19",
"2.12.18",
"2.12.17",
"2.12.16"
)
lazy val bin213 =
Seq(
defaultScala213,
"2.13.14",
"2.13.13",
"2.13.12",
"2.13.11"
)
inThisBuild(
List(
organization := "org.scoverage",
homepage := Some(url("http://scoverage.org/")),
developers := List(
Developer(
"sksamuel",
"Stephen Samuel",
url("https://github.com/sksamuel")
),
Developer(
"gslowikowski",
"Grzegorz Slowikowski",
url("https://github.com/gslowikowski")
),
Developer(
"ckipp01",
"Chris Kipp",
url("https://www.chris-kipp.io/")
)
),
licenses := Seq(
"Apache-2.0" -> url("http://www.apache.org/license/LICENSE-2.0")
),
scalaVersion := defaultScala213,
versionScheme := Some("early-semver"),
Test / fork := false,
Test / publishArtifact := false,
Test / parallelExecution := false,
Global / concurrentRestrictions += Tags.limit(Tags.Test, 1),
scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-feature",
"-encoding",
"utf8"
),
semanticdbEnabled := true,
semanticdbVersion := scalametaVersion,
scalafixScalaBinaryVersion := scalaBinaryVersion.value
)
)
lazy val sharedSettings = List(
scalacOptions := {
if (scalaVersion.value == defaultScala213) {
scalacOptions.value :+ "-Wunused:imports"
} else {
scalacOptions.value
}
},
libraryDependencies += "org.scalameta" %%% "munit" % munitVersion % Test
)
lazy val root = Project("scalac-scoverage", file("."))
.settings(
name := "scalac-scoverage",
publishArtifact := false,
publishLocal := {}
)
.aggregate(
plugin,
runtime.jvm,
runtime.js,
runtime.native,
runtimeJSDOMTest,
reporter,
domain,
serializer,
buildInfo
)
lazy val runtime = CrossProject(
"runtime",
file("runtime")
)(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.withoutSuffixFor(JVMPlatform)
.settings(
name := "scalac-scoverage-runtime",
crossScalaVersions := Seq(defaultScala212, defaultScala213),
crossTarget := target.value / s"scala-${scalaVersion.value}",
sharedSettings
)
.jvmSettings(
Test / fork := true
)
lazy val `runtimeJVM` = runtime.jvm
lazy val `runtimeJS` = runtime.js
lazy val runtimeJSDOMTest =
project
.enablePlugins(ScalaJSPlugin)
.dependsOn(runtimeJS % "test->test")
.settings(
publishArtifact := false,
publishLocal := {},
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv(),
sharedSettings
)
lazy val plugin =
project
// we need both runtimes compiled prior to running tests
.dependsOn(runtimeJVM % Test, runtimeJS % Test)
.settings(
name := "scalac-scoverage-plugin",
crossTarget := target.value / s"scala-${scalaVersion.value}",
crossScalaVersions := bin212 ++ bin213,
crossVersion := CrossVersion.full,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided,
sharedSettings
)
.settings(
Test / unmanagedSourceDirectories += (Test / sourceDirectory).value / "scala-2.12+",
Test / unmanagedSourceDirectories ++= {
val sourceDir = (Test / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 13 => Seq(sourceDir / "scala-2.13+")
case _ => Seq.empty
}
}
)
.dependsOn(domain, reporter % "test->compile", serializer, buildInfo % Test)
lazy val reporter =
project
.settings(
name := "scalac-scoverage-reporter",
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "2.3.0",
sharedSettings,
crossScalaVersions := Seq(defaultScala212, defaultScala213, defaultScala3)
)
.dependsOn(domain, serializer)
lazy val buildInfo =
project
.settings(
crossScalaVersions := bin212 ++ bin213,
buildInfoKeys += BuildInfoKey("scalaJSVersion", scalaJSVersion),
publishArtifact := false,
publishLocal := {}
)
.enablePlugins(BuildInfoPlugin)
lazy val domain =
project
.settings(
name := "scalac-scoverage-domain",
sharedSettings,
crossScalaVersions := Seq(defaultScala212, defaultScala213, defaultScala3)
)
lazy val serializer =
project
.settings(
name := "scalac-scoverage-serializer",
sharedSettings,
crossScalaVersions := Seq(defaultScala212, defaultScala213, defaultScala3)
)
.dependsOn(domain)
addCommandAlias(
"styleFix",
"scalafixAll ; scalafmtAll ; scalafmtSbt"
)
addCommandAlias(
"styleCheck",
"scalafmtCheckAll ; scalafmtSbtCheck ; scalafix --check"
)