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

Any plan to support incremental compilation? #492

Open
crakjie opened this issue Jul 28, 2022 · 3 comments
Open

Any plan to support incremental compilation? #492

crakjie opened this issue Jul 28, 2022 · 3 comments

Comments

@crakjie
Copy link

crakjie commented Jul 28, 2022

Describe the bug

Currently every time a compilation is done the datadir is cleaned. Then the scoverage.coverage is regenerated only with the compiled satements. So when the report is then generated it contains only the coverage for few statements.

It happens after incremental compilation, it happen when pulling sbt remote cache, it also happen when source files are regenerated for every build (ie file generated by https://github.com/sbt/sbt-buildinfo).

I'm not saying that having the coverage for only what was recompiled is useless. A merge request could show the percentage of coverage of it's added lines.
But for project using generated source it's make it impossible to extract coverage as that compilation of generated file are done sperately.

Expected behavior

Re-calculate the scoverage.coverage for the whole source code instead, or at least having the option to do so.
I think the already compiled code would not have to be re-instrumented because it was already done in the previous compilations.

What build tool are you using?

sbt

Version of scoverage

1.4.11

@ckipp01
Copy link
Member

ckipp01 commented Jul 29, 2022

Thanks for the report @crakjie. Could you explain a bit more of your workflow? Typically scoverage shouldn't be enabled while developing where continual incremental compilations is happening. Rather the flow is typically that coverage is enabled, which will force a full recompile and then the tests run, a report is generated, and coverage is disabled. Could you outline how you're using scoverage?

@crakjie
Copy link
Author

crakjie commented Aug 3, 2022

The idea is to benefit from incremental compilation even in the CI process.
Ou compilation take around 10 minutes on our small CI runner. So we push the build result with pushRemoteCache into a shared directory which is then pulled for each CI run. Because most MR impact few files most part is already compiled and compilation then take around 10s on average. Then we usually trigger another a recompilation without coverage to have a build without instrumentation (I'm not sure if it's useful).

But, as you guess, scoverage is cleaning the datadir which then make the coverage incomplete.

I also have problem with the buildInfo that are triggering a re-compilation every time because a timestamp is written in the file (but that should be managable)

@lolgab
Copy link

lolgab commented Nov 6, 2023

@crakjie I'm not sure if you have the same problem as I do, but I found this workaround that works well for my team: scoverage/sbt-scoverage#309 (comment)

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

No branches or pull requests

3 participants