From 98515aa6d3b632a20f3dd167045acd143e773256 Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Mon, 8 Aug 2022 18:09:26 +0200 Subject: [PATCH] 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. --- README.md | 4 +++- src/main/scala/scoverage/ScoverageSbtPlugin.scala | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c279783d..613d1f5a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ sbt-scoverage is an sbt plugin that offers support for Scala code coverage using [scoverage](https://github.com/scoverage/scalac-scoverage-plugin). This plugin supports Scala 2.12, 2.13, and 3. -*NOTE*: that ScalaJS and Scala Native support is limited to Scala 2. +**NOTE**: that ScalaJS and Scala Native support is limited to Scala 2. +**NOTE**: that Scala 3 support starts with 3.2.x. + ## Setup diff --git a/src/main/scala/scoverage/ScoverageSbtPlugin.scala b/src/main/scala/scoverage/ScoverageSbtPlugin.scala index 4a920c1d..515f4a03 100644 --- a/src/main/scala/scoverage/ScoverageSbtPlugin.scala +++ b/src/main/scala/scoverage/ScoverageSbtPlugin.scala @@ -110,6 +110,9 @@ object ScoverageSbtPlugin extends AutoPlugin { private lazy val scalacSettings = Seq( Compile / compile / scalacOptions ++= { + + implicit val log = streams.value.log + val updateReport = update.value if (coverageEnabled.value && isScala2(scalaVersion.value)) { val scoverageDeps: Seq[File] = @@ -168,6 +171,11 @@ object ScoverageSbtPlugin extends AutoPlugin { Seq( s"-coverage-out:${coverageDataDir.value.getAbsolutePath()}/scoverage-data" ) + } else if (coverageEnabled.value && !isScala2(scalaVersion.value)) { + log.warn( + "coverage in Scala 3 needs at lease 3.2.x. Please update your Scala version and try again." + ) + Nil } else { Nil }