jacoco
jacoco copied to clipboard
Add filter for Jetpack Compose generated bytecode
This PR fixes #1208.
I'm aware that adding such thing to general purpose jvm coverage tool seems strange. Ideally there should be some extension mechanism in JaCoCo which allows adding IFilter
in similar way as excludes
are added. This could be utilized by android gradle plugin. However as there is no such feature and there is high need from android developers using Jetpack Compose (at least from those who use some coverage quality gates like my company) I decided to submit this PR.
@lsuski Tried your fork in my Compose project and it works great with instrumentation tests. Unfortunately Roboelectric unit tests report now 0% coverage, where with 0.8.7 Jacoco, they at least report somewhat correct instruction coverage. Would it be possible to support both?
Pushed an example project showing the problem in case you weren't aware of the issue: https://github.com/Avenire/jacoco-compose-test
I'll check, in my projects I have some roboletric tests and coverage is quite fine (there are some uncovered lines even though they should be but the coberage is about 70%)
Hey @lsuski ! Awesome work! What's the easiest way to use your fork in our projects?
@sarn0ld you have to build my fork on your own. I didn't publish it publicly. I use my company internal maven repo
Any chance this will get merged soon? For me it is not clear whats blocking this PR?
I think that the main problem is that JaCoCo is meant to be Jvm general coverage tool and should not have any specific frameworks filters and JetPack Compose is a niche from JaCoCo perspective. IMHO JaCoCo should have some extension mechanism which will allow registering such filters on demand and then there will be no need to add Compose filter here, it will be added by Android Gradle Plugin or any other third party Plugin