Rename native code coverage paths product variables in Soong.
Rename `CoveragePath` and `CoverageExcludePaths` as
`NativeCoveragePath` and `NativeCoverageExcludePaths` (resp.).
Also rename function `android.CoverageEnabledForPath` as
`android.NativeCoverageEnabledForPath`.
Test: m nothing
Bug: 158212027
Change-Id: Id2c11a638e88088096420b537effa866d7667304
diff --git a/android/config.go b/android/config.go
index 59118ce..7ce623d 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1041,15 +1041,20 @@
return Bool(c.config.productVariables.ClangCoverage)
}
-func (c *deviceConfig) CoverageEnabledForPath(path string) bool {
+// NativeCoverageEnabledForPath returns whether (GCOV- or Clang-based) native
+// code coverage is enabled for path. By default, coverage is not enabled for a
+// given path unless it is part of the NativeCoveragePaths product variable (and
+// not part of the NativeCoverageExcludePaths product variable). Value "*" in
+// NativeCoveragePaths represents any path.
+func (c *deviceConfig) NativeCoverageEnabledForPath(path string) bool {
coverage := false
- if c.config.productVariables.CoveragePaths != nil {
- if InList("*", c.config.productVariables.CoveragePaths) || HasAnyPrefix(path, c.config.productVariables.CoveragePaths) {
+ if c.config.productVariables.NativeCoveragePaths != nil {
+ if InList("*", c.config.productVariables.NativeCoveragePaths) || HasAnyPrefix(path, c.config.productVariables.NativeCoveragePaths) {
coverage = true
}
}
- if coverage && c.config.productVariables.CoverageExcludePaths != nil {
- if HasAnyPrefix(path, c.config.productVariables.CoverageExcludePaths) {
+ if coverage && c.config.productVariables.NativeCoverageExcludePaths != nil {
+ if HasAnyPrefix(path, c.config.productVariables.NativeCoverageExcludePaths) {
coverage = false
}
}
diff --git a/android/variable.go b/android/variable.go
index 3c08405..796aada 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -266,11 +266,11 @@
SamplingPGO *bool `json:",omitempty"`
- NativeLineCoverage *bool `json:",omitempty"`
- Native_coverage *bool `json:",omitempty"`
- ClangCoverage *bool `json:",omitempty"`
- CoveragePaths []string `json:",omitempty"`
- CoverageExcludePaths []string `json:",omitempty"`
+ NativeLineCoverage *bool `json:",omitempty"`
+ Native_coverage *bool `json:",omitempty"`
+ ClangCoverage *bool `json:",omitempty"`
+ NativeCoveragePaths []string `json:",omitempty"`
+ NativeCoverageExcludePaths []string `json:",omitempty"`
DevicePrefer32BitApps *bool `json:",omitempty"`
DevicePrefer32BitExecutables *bool `json:",omitempty"`
diff --git a/cc/coverage.go b/cc/coverage.go
index f885fcb..1a559a9 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -180,7 +180,7 @@
if needCoverageVariant {
// Coverage variant is actually built with coverage if enabled for its module path
- needCoverageBuild = ctx.DeviceConfig().CoverageEnabledForPath(ctx.ModuleDir())
+ needCoverageBuild = ctx.DeviceConfig().NativeCoverageEnabledForPath(ctx.ModuleDir())
}
}
diff --git a/rust/rust_test.go b/rust/rust_test.go
index d658ee2..fe21e3a 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -89,7 +89,7 @@
if coverage {
config.TestProductVariables.Native_coverage = proptools.BoolPtr(true)
- config.TestProductVariables.CoveragePaths = []string{"*"}
+ config.TestProductVariables.NativeCoveragePaths = []string{"*"}
}
t.Helper()