summaryrefslogtreecommitdiff
path: root/android/config.go
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2020-06-15 18:41:03 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-06-15 18:41:03 +0000
commitd38ab21c6ecb08763e10f2bcba4ef4243bccc9df (patch)
treece7d139a89930dd0608b3e3b70fdf1caf66b5e54 /android/config.go
parentc41c1a9d13de2ca4bedb5eeaa0b8f8dbf44a1116 (diff)
parentada1270ef8796ff436a08ff958033c9c51b94bd9 (diff)
Merge "Introduce product variables to select Java code coverage paths in Soong."
Diffstat (limited to 'android/config.go')
-rw-r--r--android/config.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index e1d597a0b..a53f44a40 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1029,6 +1029,27 @@ func (c *deviceConfig) SamplingPGO() bool {
return Bool(c.config.productVariables.SamplingPGO)
}
+// JavaCoverageEnabledForPath returns whether Java code coverage is enabled for
+// path. Coverage is enabled by default when the product variable
+// JavaCoveragePaths is empty. If JavaCoveragePaths is not empty, coverage is
+// enabled for any path which is part of this variable (and not part of the
+// JavaCoverageExcludePaths product variable). Value "*" in JavaCoveragePaths
+// represents any path.
+func (c *deviceConfig) JavaCoverageEnabledForPath(path string) bool {
+ coverage := false
+ if c.config.productVariables.JavaCoveragePaths == nil ||
+ InList("*", c.config.productVariables.JavaCoveragePaths) ||
+ HasAnyPrefix(path, c.config.productVariables.JavaCoveragePaths) {
+ coverage = true
+ }
+ if coverage && c.config.productVariables.JavaCoverageExcludePaths != nil {
+ if HasAnyPrefix(path, c.config.productVariables.JavaCoverageExcludePaths) {
+ coverage = false
+ }
+ }
+ return coverage
+}
+
func (c *config) NativeLineCoverage() bool {
return Bool(c.productVariables.NativeLineCoverage)
}