Skip to content

Commit

Permalink
Add condition on Scala 3 version
Browse files Browse the repository at this point in the history
  • Loading branch information
pikinier20 authored and ckipp01 committed Jun 3, 2022
1 parent 47458fb commit 7c804ed
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/scala/scoverage/ScoverageSbtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ object ScoverageSbtPlugin extends AutoPlugin {
}
.getOrElse(false)

private def isScala3SupportingScoverage(scalaVersion: String) =
CrossVersion
.partialVersion(scalaVersion)
.collect {
case (3, minor) if minor >= 2 => true
}
.getOrElse(false)

private lazy val coverageSettings = Seq(
libraryDependencies ++= {
if (coverageEnabled.value && isScala2(scalaVersion.value)) {
Expand Down Expand Up @@ -155,7 +163,9 @@ object ScoverageSbtPlugin extends AutoPlugin {
// rangepos is broken in some releases of scala so option to turn it off
if (coverageHighlighting.value) Some("-Yrangepos") else None
).flatten
} else if (coverageEnabled.value) {
} else if (
coverageEnabled.value && isScala3SupportingScoverage(scalaVersion.value)
) {
Seq(
s"-coverage-out:${coverageDataDir.value.getAbsolutePath()}/scoverage-data"
)
Expand Down

0 comments on commit 7c804ed

Please sign in to comment.