diff --git a/java/jacoco.go b/java/jacoco.go index c4b3e6edd..59f2fd3af 100644 --- a/java/jacoco.go +++ b/java/jacoco.go @@ -76,7 +76,7 @@ func (j *Module) jacocoModuleToZipCommand(ctx android.ModuleContext) string { func jacocoFiltersToZipCommand(includes, excludes []string) string { specs := "" if len(excludes) > 0 { - specs += android.JoinWithPrefix(excludes, "-x") + " " + specs += android.JoinWithPrefix(excludes, "-x ") + " " } if len(includes) > 0 { specs += strings.Join(includes, " ") @@ -113,6 +113,8 @@ func jacocoFilterToSpec(filter string) (string, error) { spec += "**/*.class" } else if wildcard { spec += "*.class" + } else { + spec += ".class" } return spec, nil diff --git a/java/jacoco_test.go b/java/jacoco_test.go index 832101712..6e8b02653 100644 --- a/java/jacoco_test.go +++ b/java/jacoco_test.go @@ -20,6 +20,11 @@ func TestJacocoFilterToSpecs(t *testing.T) { testCases := []struct { name, in, out string }{ + { + name: "class", + in: "package.Class", + out: "package/Class.class", + }, { name: "class wildcard", in: "package.Class*", @@ -71,6 +76,12 @@ func TestJacocoFiltersToZipCommand(t *testing.T) { includes: []string{"package/Class.class", "package2/Class.class"}, out: "package/Class.class package2/Class.class", }, + { + name: "excludes", + includes: []string{"package/**/*.class"}, + excludes: []string{"package/Class.class"}, + out: "-x package/Class.class package/**/*.class", + }, } for _, testCase := range testCases {