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

Isolate scoverage modules from their parent modules #3118

Merged
merged 10 commits into from
Apr 12, 2024

Conversation

romain-gilles-ultra
Copy link
Contributor

@romain-gilles-ultra romain-gilles-ultra commented Apr 9, 2024

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 romain-gilles-ultra changed the title Isolate scoverage modules from their parent module Isolate scoverage modules from their parent modules Apr 9, 2024
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with the changes from #3090 and #3064, the classpath part of interest is outer.localRunClasspath. If we override the runClasspath and remove outer.localRunClasspath from it and add outer.scoverage.localRunClasspath, we should be done, without needing to introduce the shadow test module.

Also, this PR changes various other places unrelated to the essential feature. It would be good to keep the changeset minimal.

example/misc/7-contrib-scoverage/build.sc Outdated Show resolved Hide resolved
example/misc/7-contrib-scoverage/build.sc Show resolved Hide resolved
@romain-gilles-ultra
Copy link
Contributor Author

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

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you!

@lefou
Copy link
Member

lefou commented Apr 12, 2024

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

@romain-gilles-ultra
Copy link
Contributor Author

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

Done

@lefou lefou merged commit 43c192a into com-lihaoyi:main Apr 12, 2024
38 checks passed
@lefou lefou added this to the 0.11.8 milestone Apr 12, 2024
Quafadas pushed a commit to Quafadas/mill that referenced this pull request Apr 15, 2024
## 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.

Pull request: com-lihaoyi#3118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants