Loading android/config.go +10 −5 Original line number Diff line number Diff line Loading @@ -1041,15 +1041,20 @@ func (c *deviceConfig) ClangCoverageEnabled() bool { 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 } } Loading android/variable.go +5 −5 Original line number Diff line number Diff line Loading @@ -269,8 +269,8 @@ type productVariables struct { NativeLineCoverage *bool `json:",omitempty"` Native_coverage *bool `json:",omitempty"` ClangCoverage *bool `json:",omitempty"` CoveragePaths []string `json:",omitempty"` CoverageExcludePaths []string `json:",omitempty"` NativeCoveragePaths []string `json:",omitempty"` NativeCoverageExcludePaths []string `json:",omitempty"` SanitizeHost []string `json:",omitempty"` SanitizeDevice []string `json:",omitempty"` Loading cc/coverage.go +1 −1 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ func SetCoverageProperties(ctx android.BaseModuleContext, properties CoveragePro 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()) } } Loading rust/rust_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ func testRustContext(t *testing.T, bp string, coverage bool) *android.TestContex if coverage { config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) config.TestProductVariables.CoveragePaths = []string{"*"} config.TestProductVariables.NativeCoveragePaths = []string{"*"} } t.Helper() Loading Loading
android/config.go +10 −5 Original line number Diff line number Diff line Loading @@ -1041,15 +1041,20 @@ func (c *deviceConfig) ClangCoverageEnabled() bool { 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 } } Loading
android/variable.go +5 −5 Original line number Diff line number Diff line Loading @@ -269,8 +269,8 @@ type productVariables struct { NativeLineCoverage *bool `json:",omitempty"` Native_coverage *bool `json:",omitempty"` ClangCoverage *bool `json:",omitempty"` CoveragePaths []string `json:",omitempty"` CoverageExcludePaths []string `json:",omitempty"` NativeCoveragePaths []string `json:",omitempty"` NativeCoverageExcludePaths []string `json:",omitempty"` SanitizeHost []string `json:",omitempty"` SanitizeDevice []string `json:",omitempty"` Loading
cc/coverage.go +1 −1 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ func SetCoverageProperties(ctx android.BaseModuleContext, properties CoveragePro 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()) } } Loading
rust/rust_test.go +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ func testRustContext(t *testing.T, bp string, coverage bool) *android.TestContex if coverage { config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) config.TestProductVariables.CoveragePaths = []string{"*"} config.TestProductVariables.NativeCoveragePaths = []string{"*"} } t.Helper() Loading