I tried to reproduce the problem and created these reproducers: ,
and filed this issue upstream: .
Now that we understand the problem, the solution could be also implemented
in code-owners plugin. I refactored the build to split the source rules to match
the java packages: . Now test coverage works as expected: .
BTW, you shouldn't actually need custom `tools/coverage.sh` script.
Bazel is shipping lcov merge utility. Just call the coverage command
$ bazel coverage --test_output=all \
This should produce merged coverage.dat file:
INFO: LCOV coverage report is located at /home/davido/.cache/bazel/_bazel_davido/5c01f4f713b675540b8b424c5c647f63/execroot/gerrit/bazel-out/_coverage/_coverage_report.dat
and execpath is bazel-out/_coverage/_coverage_report.dat
$ ls -all bazel-out/_coverage/_coverage_report.dat
-r-xr-xr-x 1 davido users 300658 Dec 5 19:59 bazel-out/_coverage/_coverage_report.dat