Disable default strip for host variants
https://r.android.com/3460147 turned on strip by default for all host
variants, including tests. Having debug symbols is useful for tests, so
this CL makes no strip the default for all host variants.
Bug: 401324986
Test: Verified locally that NeedsStrip returns false for all variants of
the test reported in b/401324986
Change-Id: I493091eab17cea6a9e59277d06a4ff96ac898057
diff --git a/cc/strip.go b/cc/strip.go
index a950df8..32ea38d 100644
--- a/cc/strip.go
+++ b/cc/strip.go
@@ -23,8 +23,9 @@
// StripProperties defines the type of stripping applied to the module.
type StripProperties struct {
Strip struct {
- // Device and host modules default to stripping enabled leaving mini debuginfo.
- // This can be disabled by setting none to true.
+ // Device modules default to stripping enabled leaving mini debuginfo.
+ // Host modules default to stripping disabled, but can be enabled by setting any other
+ // strip boolean property.
None *bool `android:"arch_variant"`
// all forces stripping everything, including the mini debug info.
@@ -50,7 +51,12 @@
// NeedsStrip determines if stripping is required for a module.
func (stripper *Stripper) NeedsStrip(actx android.ModuleContext) bool {
forceDisable := Bool(stripper.StripProperties.Strip.None)
- return !forceDisable
+ // Strip is enabled by default for device variants.
+ defaultEnable := actx.Device()
+ forceEnable := Bool(stripper.StripProperties.Strip.All) ||
+ Bool(stripper.StripProperties.Strip.Keep_symbols) ||
+ Bool(stripper.StripProperties.Strip.Keep_symbols_and_debug_frame)
+ return !forceDisable && (forceEnable || defaultEnable)
}
func (stripper *Stripper) strip(actx android.ModuleContext, in android.Path, out android.ModuleOutPath,