Skip to content
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

Scoverage improve classpath override to the minimal #3122

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions contrib/scoverage/src/mill/contrib/scoverage/ScoverageModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,18 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule =>
trait ScoverageTests extends ScalaTests {

/**
* Alter classfiles and resources from upstream modules and dependencies
* by removing the ones from outer.localRunClasspath() and replacing them
* with outer.scoverage.localRunClasspath()
* Alter classpath from upstream modules by replacing in-place outer module
* classes folder by the outer.scoverage classes folder and adding the
* scoverage runtime dependency.
*/
override def runClasspath: T[Seq[PathRef]] = T {
val outerLocalRunClasspath = outer.localRunClasspath().toSet
super.runClasspath().filterNot(
outerLocalRunClasspath
) ++
outer.scoverage.localRunClasspath() ++
resolveDeps(T.task {
outer.scoverageRuntimeDeps().map(bindDependency())
})()
val outerClassesPath = outer.compile().classes
val outerScoverageClassesPath = outer.scoverage.compile().classes
(super.runClasspath().map { path =>
if (outerClassesPath == path) outerScoverageClassesPath else path
} ++ resolveDeps(T.task {
outer.scoverageRuntimeDeps().map(bindDependency())
})()).distinct
}
}
}