Skip to content

Commit 98515aa

Browse files
committed
chore: make it clearer that the user should update to 3.2.x
Right now there isn't a lot of support if you try to use coverage under 3.1.x for example. This will show you a warning that you need to update to 3.2.x if you try with a Scala 3 version that isn't new enough.
1 parent 206a7c1 commit 98515aa

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ sbt-scoverage is an sbt plugin that offers support for Scala code coverage using
88
[scoverage](https://github.com/scoverage/scalac-scoverage-plugin). This plugin
99
supports Scala 2.12, 2.13, and 3.
1010

11-
*NOTE*: that ScalaJS and Scala Native support is limited to Scala 2.
11+
**NOTE**: that ScalaJS and Scala Native support is limited to Scala 2.
12+
**NOTE**: that Scala 3 support starts with 3.2.x.
13+
1214

1315
## Setup
1416

src/main/scala/scoverage/ScoverageSbtPlugin.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ object ScoverageSbtPlugin extends AutoPlugin {
110110

111111
private lazy val scalacSettings = Seq(
112112
Compile / compile / scalacOptions ++= {
113+
114+
implicit val log = streams.value.log
115+
113116
val updateReport = update.value
114117
if (coverageEnabled.value && isScala2(scalaVersion.value)) {
115118
val scoverageDeps: Seq[File] =
@@ -168,6 +171,11 @@ object ScoverageSbtPlugin extends AutoPlugin {
168171
Seq(
169172
s"-coverage-out:${coverageDataDir.value.getAbsolutePath()}/scoverage-data"
170173
)
174+
} else if (coverageEnabled.value && !isScala2(scalaVersion.value)) {
175+
log.warn(
176+
"coverage in Scala 3 needs at lease 3.2.x. Please update your Scala version and try again."
177+
)
178+
Nil
171179
} else {
172180
Nil
173181
}

0 commit comments

Comments
 (0)