jacoco icon indicating copy to clipboard operation
jacoco copied to clipboard

Add filter for Jetpack Compose generated bytecode

Open lsuski opened this issue 3 years ago • 6 comments

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 avatar Nov 25 '21 15:11 lsuski

@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

Avenire avatar Mar 31 '22 20:03 Avenire

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%)

lsuski avatar Apr 01 '22 07:04 lsuski

Hey @lsuski ! Awesome work! What's the easiest way to use your fork in our projects?

sarn0ld avatar Mar 14 '23 08:03 sarn0ld

@sarn0ld you have to build my fork on your own. I didn't publish it publicly. I use my company internal maven repo

lsuski avatar Mar 14 '23 09:03 lsuski

Any chance this will get merged soon? For me it is not clear whats blocking this PR?

G00fY2 avatar May 17 '23 13:05 G00fY2

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

lsuski avatar May 17 '23 13:05 lsuski