Use a default exclude filter for JaCoCo in Soong.
Instrumented builds should exclude certain classes from instrumenation
by default. (e.g. JaCoCo itself) Leverage the existing
DefaultJacocoExclusionFilter to do this.
Note: Two different default filters exist now (one for Make and one for
Soong), as they have different wildcard rules.
Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true m -j32
TeleService and inspected the resulting temporary jar that was
instrumented to confirm that anything from org/jacoco was excluded.
Bug: 159748844
Change-Id: I5466b0a03957edfbe53971d5d1a7729fdb8337db
diff --git a/android/config.go b/android/config.go
index 16f3d73..6f73a12 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1052,7 +1052,7 @@
// represents any path.
func (c *deviceConfig) JavaCoverageEnabledForPath(path string) bool {
coverage := false
- if c.config.productVariables.JavaCoveragePaths == nil ||
+ if len(c.config.productVariables.JavaCoveragePaths) == 0 ||
InList("*", c.config.productVariables.JavaCoveragePaths) ||
HasAnyPrefix(path, c.config.productVariables.JavaCoveragePaths) {
coverage = true