com-lihaoyi / mill

Your shiny new Java/Scala build tool!
https://mill-build.com/
MIT License
2k stars 308 forks source link

Isolate scoverage modules from their parent modules #3118

Closed romain-gilles-ultra closed 3 months ago

romain-gilles-ultra commented 3 months ago

Context

I encountered an issue with the way scoverage plugin alters the dependency tree of the test module by changing its module dependency from the outer module to the outer.scoverage module. This shadow modification of the dependency tree produces a side effect that impacts the IDEA configuration generation. When the IDEA configuration generation resolves the dependencies instead of using the outer module as a dependency for the test project it depends on the outer.scoverage module which should not be generated as it does not exist factually but more virtually.

Solution

Instead of modifying the dependency tree at compile-time I change it at runtime by removing the outer.localRunClasspath() from the test.runClasspath() and appending, instead, the outer.scoverage.localRunClasspath()

This resolves the issue of modifying the dependency tree but introduces one more compilation as when the outer.localRunClasspath() is resolved it will force the compilation of the outer module. In the previous version only the outer.scoverage was compiled and not both of them.

romain-gilles-ultra commented 3 months ago

I removed the unrelated changes I will open an other PR for those one if you are ok with that

lefou commented 3 months ago

@romain-gilles-ultra Could you please update the PR description to reflect the actual change?

romain-gilles-ultra commented 3 months ago

@romain-gilles-ultra Could you please update the PR description to reflect the actual change?

Done