Skip to content

Commit 9bc108c

Browse files
committed
Add scalacOptions for scoverage only if coverageEnabled
1 parent b91fcc8 commit 9bc108c

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/main/scala/scoverage/ScoverageSbtPlugin.scala

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,21 @@ object ScoverageSbtPlugin extends AutoPlugin {
120120
}
121121

122122
private lazy val scoverageScalacOptions = Def.task {
123-
val scoverageDeps: Seq[File] = update.value matching configurationFilter("provided")
124-
scoverageDeps.find(_.getAbsolutePath.contains(ScalacPluginArtifact)) match {
125-
case None => throw new Exception(s"Fatal: $ScalacPluginArtifact not in libraryDependencies")
126-
case Some(pluginPath) =>
127-
scalaArgs(coverageEnabled.value,
128-
pluginPath,
129-
crossTarget.value,
130-
coverageExcludedPackages.value,
131-
coverageExcludedFiles.value,
132-
coverageHighlighting.value)
123+
val isEnabled = coverageEnabled.value
124+
if (isEnabled) {
125+
val scoverageDeps: Seq[File] = update.value matching configurationFilter("provided")
126+
scoverageDeps.find(_.getAbsolutePath.contains(ScalacPluginArtifact)) match {
127+
case None => throw new Exception(s"Fatal: $ScalacPluginArtifact not in libraryDependencies")
128+
case Some(pluginPath) =>
129+
scalaArgs(coverageEnabled.value,
130+
pluginPath,
131+
crossTarget.value,
132+
coverageExcludedPackages.value,
133+
coverageExcludedFiles.value,
134+
coverageHighlighting.value)
135+
}
136+
} else {
137+
Seq()
133138
}
134139
}
135140

0 commit comments

Comments
 (0)