Skip to content

Commit de3830e

Browse files
committed
Merge pull request #129 from RichardBradley/multi-project-coverage
#87 Fix 'coverage' command for multi-project builds
2 parents 0b5a55d + 9642a98 commit de3830e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ discussion on scoverage.
1414

1515
Add the plugin to your build with the following in project/plugins.sbt:
1616
```scala
17-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.0")
17+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.1")
1818
```
1919

2020
Then run the your tests with coverage enabled by entering:

Diff for: src/main/scala/scoverage/ScoverageSbtPlugin.scala

+11-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,17 @@ object ScoverageSbtPlugin extends AutoPlugin {
4545
coverageCleanSubprojectFiles := true
4646
)
4747

48-
private def toggleCoverage(status:Boolean): State => State =
49-
state => Project.extract(state).append(Seq(coverageEnabled := status), state)
48+
/**
49+
* The "coverage" command enables or disables instrumentation for all projects
50+
* in the build.
51+
*/
52+
private def toggleCoverage(status:Boolean): State => State = { state =>
53+
val extracted = Project.extract(state)
54+
val newSettings = extracted.structure.allProjectRefs map { proj =>
55+
coverageEnabled in proj := status
56+
}
57+
extracted.append(newSettings, state)
58+
}
5059

5160
private lazy val coverageReport0 = Def.task {
5261
val target = crossTarget.value

Diff for: version.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version in ThisBuild := "1.3.0"
1+
version in ThisBuild := "1.3.1"

0 commit comments

Comments
 (0)