@@ -41,7 +41,14 @@ object ScoverageSbtPlugin extends AutoPlugin {
41
41
coverageOutputDebug := false ,
42
42
coverageCleanSubprojectFiles := true ,
43
43
coverageOutputTeamCity := false ,
44
- coveragePluginVersion := DefaultScoverageVersion
44
+ coveragePluginVersion := DefaultScoverageVersion ,
45
+ libraryDependencies <<= (libraryDependencies, coverageEnabled, scalaBinaryVersion, coveragePluginVersion) {
46
+ (deps, enabled, binaryVersion, pluginVersion) =>
47
+ if (enabled) deps ++ Seq (
48
+ OrgScoverage % (ScalacRuntimeArtifact + " _" + binaryVersion) % pluginVersion % " provided" intransitive(),
49
+ OrgScoverage % (ScalacPluginArtifact + " _" + binaryVersion) % pluginVersion % " provided" intransitive()
50
+ ) else deps
51
+ }
45
52
)
46
53
47
54
/**
@@ -52,13 +59,7 @@ object ScoverageSbtPlugin extends AutoPlugin {
52
59
val extracted = Project .extract(state)
53
60
val newSettings = extracted.structure.allProjectRefs flatMap { proj =>
54
61
Seq (
55
- coverageEnabled in proj := status,
56
- libraryDependencies in proj ++= {
57
- if (status) Seq (
58
- OrgScoverage % (ScalacRuntimeArtifact + " _" + scalaBinaryVersion.value) % DefaultScoverageVersion % " provided" intransitive(),
59
- OrgScoverage % (ScalacPluginArtifact + " _" + scalaBinaryVersion.value) % DefaultScoverageVersion % " provided" intransitive()
60
- ) else Nil
61
- }
62
+ coverageEnabled in proj := status
62
63
)
63
64
}
64
65
extracted.append(newSettings, state)
0 commit comments