Skip to content

Commit bffa0fd

Browse files
authored
Merge pull request #334 from ckipp01/update
Update to scoverage 1.4.4.
2 parents 37258c6 + abd6515 commit bffa0fd

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

build.sbt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import sbt.ScriptedPlugin.autoImport.scriptedLaunchOpts
44

55
def localSnapshotVersion = "1.7.1-SNAPSHOT"
66
def isCI = System.getenv("CI") != null
7+
def scoverageVersion = "1.4.4"
78

89
inThisBuild(
910
List(
@@ -35,12 +36,13 @@ inThisBuild(
3536
)
3637

3738
lazy val root = Project("sbt-scoverage", file("."))
38-
.enablePlugins(SbtPlugin)
39+
.enablePlugins(SbtPlugin, BuildInfoPlugin)
3940
.settings(
4041
libraryDependencies ++= Seq(
41-
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile
42+
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Compile,
43+
"org.scoverage" %% "scalac-scoverage-plugin" % scoverageVersion cross (CrossVersion.full),
4244
),
43-
libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.4.3" cross (CrossVersion.full),
45+
buildInfoKeys := Seq[BuildInfoKey]("scoverageVersion" -> scoverageVersion),
4446
Test / fork := false,
4547
Test / publishArtifact := false,
4648
Test / parallelExecution := false,

project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
22
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
3+
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")

src/main/scala/scoverage/ScoverageSbtPlugin.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import sbt._
55
import sbt.plugins.JvmPlugin
66
import scoverage.report.{CoberturaXmlWriter, CoverageAggregator, ScoverageHtmlWriter, ScoverageXmlWriter}
77
import java.time.Instant
8+
import buildinfo.BuildInfo
89

910
object 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

Comments
 (0)