Accept multiple phases instead of one #685
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Ever since #164, we have some control over phase,
scoverage-instrument
. We can just specify which phase thescoverage-instrument
should sit in by supplying a compiler option-P:scoverage:extraBeforePhase:<phaseName>
and-P:scoverage:extraAfterPhase:<phaseName>
.However, while normally up to one customized phase is enough, my use case is somewhat peculiar. I was working on a personal project which relies on chipsalliance/chisel and to generate coverage without any issue,
scoverage-instrument
must run before two phases, not just one.That's because chisel's plugin generates additional AST on the fly. Here's an example:
Source: https://github.com/chipsalliance/chisel/blob/v3.6.1/plugin/src/main/scala/chisel3/internal/plugin/ChiselComponent.scala#L194
Without specifying any of
extraBeforePhase
andextraAfterPhase
, scoverage plugin emits following warnings (on 1.9.0, now it's error afterwards).As described above, the only way to solve this is putting
scoverage-instrument
ahead of chisel's phases, calledchiselbundlephase
andchiselcomponent
.I can't simply disable such plugins because they're simply indispensible to generate a hardware code. Before this pull request, I've devised a dummy plugin to workaround such ordering issue. However, that approach is only a temporary measure, so I decided to file this feature request as well.
Change Summary
-P
option.-P:scoverage:extraBeforePhase:chiselcomponent;chiselbundlephase
;
as a delimiter to match the style of other options likeexcludedSymbols
and so on.Related issues / PRs