@@ -5,14 +5,14 @@ import sbt._
5
5
import sbt .plugins .JvmPlugin
6
6
import scoverage .report .{CoberturaXmlWriter , CoverageAggregator , ScoverageHtmlWriter , ScoverageXmlWriter }
7
7
import java .time .Instant
8
+ import buildinfo .BuildInfo
8
9
9
10
object ScoverageSbtPlugin extends AutoPlugin {
10
11
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
16
16
val autoImport = ScoverageKeys
17
17
lazy val ScoveragePluginConfig = config(" scoveragePlugin" ).hide
18
18
@@ -36,7 +36,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
36
36
coverageOutputCobertura := true ,
37
37
coverageOutputDebug := false ,
38
38
coverageOutputTeamCity := false ,
39
- coverageScalacPluginVersion := DefaultScoverageVersion
39
+ coverageScalacPluginVersion := defaultScoverageVersion
40
40
)
41
41
42
42
override def buildSettings : Seq [Setting [_]] = super .buildSettings ++
@@ -57,9 +57,9 @@ object ScoverageSbtPlugin extends AutoPlugin {
57
57
Seq (
58
58
// We only add for "compile" because of macros. This setting could be optimed to just "test" if the handling
59
59
// 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),
61
61
// 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)
63
63
)
64
64
} else
65
65
Nil
@@ -71,8 +71,8 @@ object ScoverageSbtPlugin extends AutoPlugin {
71
71
val updateReport = update.value
72
72
if (coverageEnabled.value) {
73
73
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 " )
76
76
case Some (pluginPath) => pluginPath
77
77
}
78
78
Seq (
@@ -90,7 +90,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
90
90
)
91
91
92
92
private def scalacRuntime (deps : Seq [ModuleID ]): String = {
93
- ScalacRuntimeArtifact + optionalScalaJsSuffix(deps)
93
+ scalacRuntimeArtifact + optionalScalaJsSuffix(deps)
94
94
}
95
95
96
96
// returns "_sjs$sjsVersion" for Scala.js projects or "" otherwise
0 commit comments