Enable code coverage for cc shared library
Bug: None
Test: Manual and unit tests
Change-Id: I5064e4407d3451ff172ab203256f3c073cc0ad1b
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 510ecee..66157ae 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -63,7 +63,7 @@
Enabled bazel.BoolAttribute
- Native_coverage bazel.BoolAttribute
+ Native_coverage *bool
sdkAttributes
@@ -358,6 +358,7 @@
features bazel.StringListAttribute
protoDependency *bazel.LabelAttribute
aidlDependency *bazel.LabelAttribute
+ Native_coverage *bool
}
// Convenience struct to hold all attributes parsed from compiler properties.
@@ -753,10 +754,10 @@
compilerAttrs.convertStlProps(ctx, module)
(&linkerAttrs).convertStripProps(ctx, module)
+ var nativeCoverage *bool
if module.coverage != nil && module.coverage.Properties.Native_coverage != nil &&
!Bool(module.coverage.Properties.Native_coverage) {
- // Native_coverage is arch neutral
- (&linkerAttrs).features.Append(bazel.MakeStringListAttribute([]string{"-coverage"}))
+ nativeCoverage = BoolPtr(false)
}
productVariableProps := android.ProductVariableProperties(ctx)
@@ -812,6 +813,7 @@
*features,
protoDep.protoDep,
aidlDep,
+ nativeCoverage,
}
}