When we run Jacoco code coverage of Jetpack Compose function, I like to exclude all Preview functions.
I can do so using
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
internal annotation class ExcludeFromJacocoGeneratedReport
Then for the function I like to exclude from the report, I annotate it with
@ExcludeFromJacocoGeneratedReport
@Preview(
name = "Name"
)
@Composable
private fun MyComposePreview() {
// ... function content
}
This works. But I have to add the annotation to all my Preview functions. I am hoping I can do it in the build.gradle file to exclude them all.
Is there a way to do so?