Loading android/config.go +15 −5 Original line number Diff line number Diff line Loading @@ -406,6 +406,14 @@ func NewConfig(srcDir, buildDir string) (Config, error) { return Config{}, err } if Bool(config.productVariables.GcovCoverage) && Bool(config.productVariables.ClangCoverage) { return Config{}, fmt.Errorf("GcovCoverage and ClangCoverage cannot both be set") } config.productVariables.Native_coverage = proptools.BoolPtr( Bool(config.productVariables.GcovCoverage) || Bool(config.productVariables.ClangCoverage)) return Config{config}, nil } Loading Loading @@ -1057,18 +1065,20 @@ func (c *deviceConfig) JavaCoverageEnabledForPath(path string) bool { return coverage } func (c *config) NativeLineCoverage() bool { return Bool(c.productVariables.NativeLineCoverage) } // Returns true if gcov or clang coverage is enabled. func (c *deviceConfig) NativeCoverageEnabled() bool { return Bool(c.config.productVariables.Native_coverage) || Bool(c.config.productVariables.NativeLineCoverage) return Bool(c.config.productVariables.GcovCoverage) || Bool(c.config.productVariables.ClangCoverage) } func (c *deviceConfig) ClangCoverageEnabled() bool { return Bool(c.config.productVariables.ClangCoverage) } func (c *deviceConfig) GcovCoverageEnabled() bool { return Bool(c.config.productVariables.GcovCoverage) } // 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 Loading android/variable.go +4 −2 Original line number Diff line number Diff line Loading @@ -270,12 +270,14 @@ type productVariables struct { JavaCoveragePaths []string `json:",omitempty"` JavaCoverageExcludePaths []string `json:",omitempty"` NativeLineCoverage *bool `json:",omitempty"` Native_coverage *bool `json:",omitempty"` GcovCoverage *bool `json:",omitempty"` ClangCoverage *bool `json:",omitempty"` NativeCoveragePaths []string `json:",omitempty"` NativeCoverageExcludePaths []string `json:",omitempty"` // Set by NewConfig Native_coverage *bool SanitizeHost []string `json:",omitempty"` SanitizeDevice []string `json:",omitempty"` SanitizeDeviceDiag []string `json:",omitempty"` Loading apex/apex.go +1 −1 Original line number Diff line number Diff line Loading @@ -1556,7 +1556,7 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext var _ cc.Coverage = (*apexBundle)(nil) func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool { return ctx.Device() && (ctx.DeviceConfig().NativeCoverageEnabled() || ctx.DeviceConfig().ClangCoverageEnabled()) return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled() } func (a *apexBundle) PreventInstall() { Loading apex/vndk_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { t.Run("VNDK APEX supports coverage variants", func(t *testing.T) { ctx, _ := testApex(t, bp, func(fs map[string][]byte, config android.Config) { config.TestProductVariables.GcovCoverage = proptools.BoolPtr(true) config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) }) Loading cc/coverage.go +2 −2 Original line number Diff line number Diff line Loading @@ -74,8 +74,8 @@ func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps { } func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags, PathDeps) { gcovCoverage := ctx.DeviceConfig().NativeCoverageEnabled() clangCoverage := ctx.DeviceConfig().ClangCoverageEnabled() gcovCoverage := ctx.DeviceConfig().GcovCoverageEnabled() if !gcovCoverage && !clangCoverage { return flags, deps Loading Loading @@ -161,7 +161,7 @@ func (cov *coverage) begin(ctx BaseModuleContext) { func SetCoverageProperties(ctx android.BaseModuleContext, properties CoverageProperties, moduleTypeHasCoverage bool, useSdk bool, sdkVersion string) CoverageProperties { // Coverage is disabled globally if !ctx.DeviceConfig().NativeCoverageEnabled() && !ctx.DeviceConfig().ClangCoverageEnabled() { if !ctx.DeviceConfig().NativeCoverageEnabled() { return properties } Loading Loading
android/config.go +15 −5 Original line number Diff line number Diff line Loading @@ -406,6 +406,14 @@ func NewConfig(srcDir, buildDir string) (Config, error) { return Config{}, err } if Bool(config.productVariables.GcovCoverage) && Bool(config.productVariables.ClangCoverage) { return Config{}, fmt.Errorf("GcovCoverage and ClangCoverage cannot both be set") } config.productVariables.Native_coverage = proptools.BoolPtr( Bool(config.productVariables.GcovCoverage) || Bool(config.productVariables.ClangCoverage)) return Config{config}, nil } Loading Loading @@ -1057,18 +1065,20 @@ func (c *deviceConfig) JavaCoverageEnabledForPath(path string) bool { return coverage } func (c *config) NativeLineCoverage() bool { return Bool(c.productVariables.NativeLineCoverage) } // Returns true if gcov or clang coverage is enabled. func (c *deviceConfig) NativeCoverageEnabled() bool { return Bool(c.config.productVariables.Native_coverage) || Bool(c.config.productVariables.NativeLineCoverage) return Bool(c.config.productVariables.GcovCoverage) || Bool(c.config.productVariables.ClangCoverage) } func (c *deviceConfig) ClangCoverageEnabled() bool { return Bool(c.config.productVariables.ClangCoverage) } func (c *deviceConfig) GcovCoverageEnabled() bool { return Bool(c.config.productVariables.GcovCoverage) } // 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 Loading
android/variable.go +4 −2 Original line number Diff line number Diff line Loading @@ -270,12 +270,14 @@ type productVariables struct { JavaCoveragePaths []string `json:",omitempty"` JavaCoverageExcludePaths []string `json:",omitempty"` NativeLineCoverage *bool `json:",omitempty"` Native_coverage *bool `json:",omitempty"` GcovCoverage *bool `json:",omitempty"` ClangCoverage *bool `json:",omitempty"` NativeCoveragePaths []string `json:",omitempty"` NativeCoverageExcludePaths []string `json:",omitempty"` // Set by NewConfig Native_coverage *bool SanitizeHost []string `json:",omitempty"` SanitizeDevice []string `json:",omitempty"` SanitizeDeviceDiag []string `json:",omitempty"` Loading
apex/apex.go +1 −1 Original line number Diff line number Diff line Loading @@ -1556,7 +1556,7 @@ func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext var _ cc.Coverage = (*apexBundle)(nil) func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool { return ctx.Device() && (ctx.DeviceConfig().NativeCoverageEnabled() || ctx.DeviceConfig().ClangCoverageEnabled()) return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled() } func (a *apexBundle) PreventInstall() { Loading
apex/vndk_test.go +1 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) { t.Run("VNDK APEX supports coverage variants", func(t *testing.T) { ctx, _ := testApex(t, bp, func(fs map[string][]byte, config android.Config) { config.TestProductVariables.GcovCoverage = proptools.BoolPtr(true) config.TestProductVariables.Native_coverage = proptools.BoolPtr(true) }) Loading
cc/coverage.go +2 −2 Original line number Diff line number Diff line Loading @@ -74,8 +74,8 @@ func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps { } func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags, PathDeps) { gcovCoverage := ctx.DeviceConfig().NativeCoverageEnabled() clangCoverage := ctx.DeviceConfig().ClangCoverageEnabled() gcovCoverage := ctx.DeviceConfig().GcovCoverageEnabled() if !gcovCoverage && !clangCoverage { return flags, deps Loading Loading @@ -161,7 +161,7 @@ func (cov *coverage) begin(ctx BaseModuleContext) { func SetCoverageProperties(ctx android.BaseModuleContext, properties CoverageProperties, moduleTypeHasCoverage bool, useSdk bool, sdkVersion string) CoverageProperties { // Coverage is disabled globally if !ctx.DeviceConfig().NativeCoverageEnabled() && !ctx.DeviceConfig().ClangCoverageEnabled() { if !ctx.DeviceConfig().NativeCoverageEnabled() { return properties } Loading