-
Notifications
You must be signed in to change notification settings - Fork 126
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
Any plans for a Dotty/Scala3 version of scoverage? #299
Comments
Something I will investigate now that Scala 3 has been gone into feature freeze. |
Any update? Scala 3 is in RC1 now. |
This comment has been minimized.
This comment has been minimized.
A prototype code coverage implementation for Dotty was implemented in a fork of the compiler a few years ago with promising results: the report is at http://guillaume.martres.me/code_coverage.pdf, the code at https://github.com/Qjaquier/dotty/tree/coverage with an example usage at https://github.com/Qjaquier/dotty-coverage-tools. I think it'd be great to get this merged into the compiler but we need a volunteer to rebase and complete the prototype. |
Any update on when this will be addressed? |
@smarter if someone was to grab this, would the goal be to still have this as a standalone compiler plugin, or does what you wrote imply that there'd be a desire to have actually in the compiler? |
I think it'd be great to have this built into the compiler under a flag yes. |
@smarter Is there a reason why its being integrated straight into the compiler rather than a plugin? To me it seems like having it as a plugin is more ideal since
Just my 2 cents, not sure if there is more context behind including in the actual compiler itself. |
|
Thanks for the answer, didn't realize that Scala3 is expected to release so frequently. In this case then yes, it does make sense indeed. |
So just a heads up that I've gone ahead and started on this. Thanks for the links @smarter, they're super helpful. One thing that popped up right away is the fact that not only the instrumentation is being done in that POC, but the full serialization to the XML report. Is this desired? When I was originally thinking about this I sort of thought that the compiler would produce the actual coverage files, but the logic to go from the instrumentation files to XML would actually be handled by scoverage or could be swapped our for whatever tooling the user wants. Any thoughts on this, or is it desirable to have the full XML writing be done by the compiler? Also, should I create an issue for this in the Dotty repo, or is having this in here fine enough? As soon as I wrap my head around it all and clean it up a bit I'll shoot in a draft PR. |
I don't have a particular opinion on that, I'd say whatever is easier to maintain is best, in particular I think it's important to be able to test that the coverage support is actually working from the dotty CI, but that could possibly be done by having scoverage in our community build.
I think this issue is enough |
For those of you following along, here is a little update. I'm getting pretty close to shooting in a PR to get some feedback. Here is a little demo of it working. Can't get the video preview to work, so you can find it here: Scala 3 scoverage There will be a At this stage the remaining things I need to work out are:
EDIT: While working on a few things it also made sense to work on some long-standing issues since we'll be breaking compatibility anyways. You can follow along with those plans here in #368. |
Happy to see that my POC is somehow useful and that this topic is moving forward! I went away from the topic lately, but let me know if I can do anything to help. |
Your work has been incredibly helpful @Qjaquier!! I do have a question that I'm curious if you hit on or had put any thought into while doing your POC since something I'm stuck on at the moment. In scoverage the runtime/invoker is basically re-created on every run. For example if you start sbt shell, run your test, it will create a new instance of In the POC and my implementation, if you did that same workflow, the Did you put any thought into how to "clear" that state, or create a new Invoker each time to avoid this problem? Let me know if what I explained doesn't make sense and I can give some more detailed example. Thanks again for all the work you've put into this. I hope to have it finished soon, but have been quite swamped with other things lately. |
I remember that the code of the Invoker was simplified (probably over simplified ?) in order to suit the needs of the POC and that I tried a few experiments in order to reduce the impact on performance, but as far as I remember, nothing was done to answer the problem you describe. |
Just to tie this all together, the initial pr has been created here for the support in Dotty. You can also read about some of the other changes that was necessary in this repo here: |
Seeing that coverage support has now been merged into Dotty as of scala/scala3#13880 (thanks to the work of @TheElectronWill), I'll go ahead and close this. The V2 RC series will have another release shortly, and if nothing goes wrong, that will become 2.0. Support for coverage in Scala 3 will first be available in the 3.2.x series, and there is a pr in sbt-scoverage as well to ensure everything works smoothly scoverage/sbt-scoverage#429. |
Now that 2.0.0 is released users are able to use this in conjunction with Scala 3.2.0-RC1 for code coverage support for Scala 3. 2.0.0 of |
@ckipp01 I just tried this plugin with Scala 3.1.3 and got no coverage information reported. Are you saying it only works with Scala 3.2.0-RC1 onward? |
Correct. |
Scoverage is the de-facto coverage tool for the Scala ecosystem. Sure sbt-jacoco exists, and I even managed to coerce it to work with Dotty, but operating just on class files does not yield ideal results. scoverage has always done very well.
Regaining scoverage as a key piece of Scala 3 ecosystem would be huge, as for now there really is nothing else.
Any plans?
The text was updated successfully, but these errors were encountered: