-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
coverage data does not survive remote cache push-pull #421
Comments
@vlfig were you able to find a workaround for this by a chance? |
No, I was not. We're just not using remote cache. |
Maybe you could add the coverage data directory to |
For those who need it to work - it's possible to add an AutoPlugin as a workaround import sbt.*
import sbt.Keys.*
import sbt.internal.RemoteCache
import sbt.internal.remotecache.CustomRemoteCacheArtifact
import sbt.io.IO
import scoverage.ScoverageSbtPlugin
import scoverage.ScoverageKeys._
object ScoverageCachePlugin extends AutoPlugin {
val packCoverage = taskKey[File]("packCoverage")
override def projectSettings: Seq[Def.Setting[_]] = Seq(
Test / packCoverage := {
val root = coverageDataDir.value / "scoverage-data"
val output = coverageDataDir.value / "coverage.jar"
val files = IO.listFiles(root)
val z = IO.zip(files.map(f => f -> IO.relativizeFile(root, f).getOrElse(f).toPath.toString), output, None)
output
},
Test / pushRemoteCache / pushRemoteCacheConfiguration / remoteCacheArtifacts += CustomRemoteCacheArtifact(
Artifact(moduleName.value, "cached-scoverage"),
Test / packCoverage,
coverageDataDir.value / "scoverage-data",
true
)
)
override def trigger = allRequirements
override def requires = ScoverageSbtPlugin
} This code has a little downside (an extra artifact is added even when coverage is not enabled), but just because it's impossible to get project settings from autoplugin |
I'm a bit unsure where to post this but here goes.
coverageDataDir + "/scoverage-data/"
doesn't get cached onpushRemoteCache
. This breaks tests on instrumented code.Example script below:
Maybe tweak
ThisBuild / Compile / pushRemoteCacheConfiguration / remoteCacheArtifacts
?Thanks!
The text was updated successfully, but these errors were encountered: