@@ -5,14 +5,14 @@ import sbt._
55import sbt .plugins .JvmPlugin
66import scoverage .report .{CoberturaXmlWriter , CoverageAggregator , ScoverageHtmlWriter , ScoverageXmlWriter }
77import java .time .Instant
8+ import buildinfo .BuildInfo
89
910object ScoverageSbtPlugin extends AutoPlugin {
1011
11- val OrgScoverage = " org.scoverage"
12- val ScalacRuntimeArtifact = " scalac-scoverage-runtime"
13- val ScalacPluginArtifact = " scalac-scoverage-plugin"
14- // this should match the version defined in build.sbt
15- val DefaultScoverageVersion = " 1.4.3"
12+ val orgScoverage = " org.scoverage"
13+ val scalacRuntimeArtifact = " scalac-scoverage-runtime"
14+ val scalacPluginArtifact = " scalac-scoverage-plugin"
15+ val defaultScoverageVersion = BuildInfo .scoverageVersion
1616 val autoImport = ScoverageKeys
1717 lazy val ScoveragePluginConfig = config(" scoveragePlugin" ).hide
1818
@@ -36,7 +36,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
3636 coverageOutputCobertura := true ,
3737 coverageOutputDebug := false ,
3838 coverageOutputTeamCity := false ,
39- coverageScalacPluginVersion := DefaultScoverageVersion
39+ coverageScalacPluginVersion := defaultScoverageVersion
4040 )
4141
4242 override def buildSettings : Seq [Setting [_]] = super .buildSettings ++
@@ -57,9 +57,9 @@ object ScoverageSbtPlugin extends AutoPlugin {
5757 Seq (
5858 // We only add for "compile" because of macros. This setting could be optimed to just "test" if the handling
5959 // of macro coverage was improved.
60- (OrgScoverage %% (scalacRuntime(libraryDependencies.value)) % coverageScalacPluginVersion.value).cross(CrossVersion .full),
60+ (orgScoverage %% (scalacRuntime(libraryDependencies.value)) % coverageScalacPluginVersion.value).cross(CrossVersion .full),
6161 // We don't want to instrument the test code itself, nor add to a pom when published with coverage enabled.
62- (OrgScoverage %% ScalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig .name).cross(CrossVersion .full)
62+ (orgScoverage %% scalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig .name).cross(CrossVersion .full)
6363 )
6464 } else
6565 Nil
@@ -71,8 +71,8 @@ object ScoverageSbtPlugin extends AutoPlugin {
7171 val updateReport = update.value
7272 if (coverageEnabled.value) {
7373 val scoverageDeps : Seq [File ] = updateReport matching configurationFilter(ScoveragePluginConfig .name)
74- val pluginPath : File = scoverageDeps.find(_.getAbsolutePath.contains(ScalacPluginArtifact )) match {
75- case None => throw new Exception (s " Fatal: $ScalacPluginArtifact not in libraryDependencies " )
74+ val pluginPath : File = scoverageDeps.find(_.getAbsolutePath.contains(scalacPluginArtifact )) match {
75+ case None => throw new Exception (s " Fatal: $scalacPluginArtifact not in libraryDependencies " )
7676 case Some (pluginPath) => pluginPath
7777 }
7878 Seq (
@@ -90,7 +90,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
9090 )
9191
9292 private def scalacRuntime (deps : Seq [ModuleID ]): String = {
93- ScalacRuntimeArtifact + optionalScalaJsSuffix(deps)
93+ scalacRuntimeArtifact + optionalScalaJsSuffix(deps)
9494 }
9595
9696 // returns "_sjs$sjsVersion" for Scala.js projects or "" otherwise
0 commit comments