Skip to content

Add coverage include and exclude flags#356

Open
Steffeeen wants to merge 1 commit into
bazelbuild:masterfrom
Steffeeen:jacoco-filtering
Open

Add coverage include and exclude flags#356
Steffeeen wants to merge 1 commit into
bazelbuild:masterfrom
Steffeeen:jacoco-filtering

Conversation

@Steffeeen
Copy link
Copy Markdown

@Steffeeen Steffeeen commented May 9, 2026

This is my first time writing custom starlark rules. Please let me know if I need to change anything/did anything wrong.

These new flags allow filtering which classes get instrumented when collecting coverage. The include and exclude lists are the same mechanism as used by JaCoCo.

Example for only instrumenting classes in the com.example package:

bazel coverage //... --@rules_java//java/config:coverage_includes=com/example/*

I'm not sure if we should add tests for these new flags or if that's even possible. These new flags also need to be documented somewhere, but I wasn't sure where to put documentation for them.

Requires bazelbuild/bazel#29502 to be merged.

These new flags allow filtering which classes get instrumented for
collecting coverage.
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

Successfully merging this pull request may close these issues.

1 participant