From 7d71be99423bc5f9fbcd0ca0b47057b9b08e1294 Mon Sep 17 00:00:00 2001 From: Eugene Platonov Date: Sun, 25 Aug 2024 16:26:24 -0400 Subject: [PATCH] Support file and package exclusions for Scala 3.X.Y for Y < 2 --- src/main/scala/scoverage/ScoverageSbtPlugin.scala | 6 ++++-- .../scoverage/scala3-coverage-excluded-packages/build.sbt | 2 +- .../scoverage/scala3-coverage-excluded-packages/test | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/scala/scoverage/ScoverageSbtPlugin.scala b/src/main/scala/scoverage/ScoverageSbtPlugin.scala index c48d3d8..4e3662d 100644 --- a/src/main/scala/scoverage/ScoverageSbtPlugin.scala +++ b/src/main/scala/scoverage/ScoverageSbtPlugin.scala @@ -93,8 +93,10 @@ object ScoverageSbtPlugin extends AutoPlugin { CrossVersion .partialVersion(scalaVersion) .exists { - case (3, minor) if minor >= 4 && patch.exists(_ >= "2") => true - case _ => false + case (3, minor) + if minor > 4 || (minor == 4 && patch.exists(_ >= "2")) => + true + case _ => false } } diff --git a/src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt b/src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt index 7a43f4c..0c724f1 100644 --- a/src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt +++ b/src/sbt-test/scoverage/scala3-coverage-excluded-packages/build.sbt @@ -1,6 +1,6 @@ version := "0.1" -scalaVersion := "3.4.2" +scalaVersion := "3.5.0" libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test diff --git a/src/sbt-test/scoverage/scala3-coverage-excluded-packages/test b/src/sbt-test/scoverage/scala3-coverage-excluded-packages/test index 13dcccc..f079e48 100644 --- a/src/sbt-test/scoverage/scala3-coverage-excluded-packages/test +++ b/src/sbt-test/scoverage/scala3-coverage-excluded-packages/test @@ -4,6 +4,6 @@ > test > coverageReport # There should be no directory for the excluded package -$ exists target/scala-3.4.2/scoverage-report/GoodCoverage.scala.html --$ exists target/scala-3.4.2/scoverage-report/two --$ exists target/scala-3.4.2/scoverage-report/three +$ exists target/scala-3.5.0/scoverage-report/GoodCoverage.scala.html +-$ exists target/scala-3.5.0/scoverage-report/two +-$ exists target/scala-3.5.0/scoverage-report/three