From 851a3271ceec1f623e8a2283ebeea5f71ae833a2 Mon Sep 17 00:00:00 2001 From: Usta Date: Wed, 5 Jan 2022 23:42:33 -0500 Subject: [PATCH] Use Module.GetProperties() instead of ModuleBase.generalProperties ModuleBase.generalProperties served the pupose of being a subset of ModuleBase.customizableProperties. But now with the removal of the latter, the former is simply a redirection to Module.GetProperties() Bug: 206961391 Test: m nothing and diff the ninja files Change-Id: I6dd8b7ba74eb5e7ffb61029b0f9129eec2ccfdaf --- android/arch.go | 13 +++++-------- android/defaults.go | 2 -- android/hooks.go | 2 +- android/license.go | 2 -- android/license_kind.go | 2 -- android/licenses_test.go | 2 -- android/module.go | 13 +++++-------- android/path_properties.go | 2 +- android/prebuilt.go | 1 - android/variable.go | 2 +- 10 files changed, 13 insertions(+), 28 deletions(-) diff --git a/android/arch.go b/android/arch.go index fb33f3030..96a4cbf09 100644 --- a/android/arch.go +++ b/android/arch.go @@ -993,8 +993,6 @@ func initArchModule(m Module) { base := m.base() - // Store the original list of top level property structs - base.generalProperties = m.GetProperties() if len(base.archProperties) != 0 { panic(fmt.Errorf("module %s already has archProperties", m.Name())) } @@ -1015,7 +1013,7 @@ func initArchModule(m Module) { return t } - for _, properties := range base.generalProperties { + for _, properties := range m.GetProperties() { t := getStructType(properties) // Get or create the arch-specific property struct types for this property struct type. archPropTypes := archPropTypeMap.Once(NewCustomOnceKey(t), func() interface{} { @@ -1036,7 +1034,6 @@ func initArchModule(m Module) { m.AddProperties(archProperties...) } - base.generalProperties = m.GetProperties() } func maybeBlueprintEmbed(src reflect.Value) reflect.Value { @@ -1110,7 +1107,7 @@ func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) { os := m.commonProperties.CompileOS for i := range m.archProperties { - genProps := m.generalProperties[i] + genProps := m.GetProperties()[i] if m.archProperties[i] == nil { continue } @@ -1438,7 +1435,7 @@ func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { os := m.Os() for i := range m.archProperties { - genProps := m.generalProperties[i] + genProps := m.GetProperties()[i] if m.archProperties[i] == nil { continue } @@ -2016,8 +2013,8 @@ func (m *ModuleBase) GetArchVariantProperties(ctx ArchVariantContext, propertySe var archProperties []interface{} // First find the property set in the module that corresponds to the requested - // one. m.archProperties[i] corresponds to m.generalProperties[i]. - for i, generalProp := range m.generalProperties { + // one. m.archProperties[i] corresponds to m.GetProperties()[i]. + for i, generalProp := range m.GetProperties() { srcType := reflect.ValueOf(generalProp).Type() if srcType == dstType { archProperties = m.archProperties[i] diff --git a/android/defaults.go b/android/defaults.go index 15fd67595..8b121f6d9 100644 --- a/android/defaults.go +++ b/android/defaults.go @@ -96,8 +96,6 @@ func InitDefaultableModule(module DefaultableModule) { module.setProperties(module.GetProperties(), module.base().variableProperties) module.AddProperties(module.defaults()) - - module.base().generalProperties = module.GetProperties() } // A restricted subset of context methods, similar to LoadHookContext. diff --git a/android/hooks.go b/android/hooks.go index 1b61cd70f..bded76467 100644 --- a/android/hooks.go +++ b/android/hooks.go @@ -68,7 +68,7 @@ func (l *loadHookContext) moduleFactories() map[string]blueprint.ModuleFactory { func (l *loadHookContext) appendPrependHelper(props []interface{}, extendFn func([]interface{}, interface{}, proptools.ExtendPropertyFilterFunc) error) { for _, p := range props { - err := extendFn(l.Module().base().generalProperties, p, nil) + err := extendFn(l.Module().base().GetProperties(), p, nil) if err != nil { if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { l.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) diff --git a/android/license.go b/android/license.go index d7e1d8757..587cb36de 100644 --- a/android/license.go +++ b/android/license.go @@ -80,8 +80,6 @@ func LicenseFactory() Module { base := module.base() module.AddProperties(&base.nameProperties, &module.properties) - base.generalProperties = module.GetProperties() - // The visibility property needs to be checked and parsed by the visibility module. setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility) diff --git a/android/license_kind.go b/android/license_kind.go index f007ef146..838deddd2 100644 --- a/android/license_kind.go +++ b/android/license_kind.go @@ -53,8 +53,6 @@ func LicenseKindFactory() Module { base := module.base() module.AddProperties(&base.nameProperties, &module.properties) - base.generalProperties = module.GetProperties() - // The visibility property needs to be checked and parsed by the visibility module. setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility) diff --git a/android/licenses_test.go b/android/licenses_test.go index 6ddbd3e58..70160faf2 100644 --- a/android/licenses_test.go +++ b/android/licenses_test.go @@ -779,8 +779,6 @@ func newMockLicensesBadModule() Module { base := m.base() m.AddProperties(&base.nameProperties, &m.properties) - base.generalProperties = m.GetProperties() - // The default_visibility property needs to be checked and parsed by the visibility module during // its checking and parsing phases so make it the primary visibility property. setPrimaryVisibilityProperty(m, "visibility", &m.properties.Visibility) diff --git a/android/module.go b/android/module.go index d2c4d402a..c2fa84847 100644 --- a/android/module.go +++ b/android/module.go @@ -1032,8 +1032,6 @@ func InitAndroidModule(m Module) { initProductVariableModule(m) - base.generalProperties = m.GetProperties() - // The default_visibility property needs to be checked and parsed by the visibility module during // its checking and parsing phases so make it the primary visibility property. setPrimaryVisibilityProperty(m, "visibility", &base.commonProperties.Visibility) @@ -1207,13 +1205,12 @@ type ModuleBase struct { distProperties distProperties variableProperties interface{} hostAndDeviceProperties hostAndDeviceProperties - generalProperties []interface{} - // Arch specific versions of structs in generalProperties. The outer index - // has the same order as generalProperties as initialized in - // InitAndroidArchModule, and the inner index chooses the props specific to - // the architecture. The interface{} value is an archPropRoot that is - // filled with arch specific values by the arch mutator. + // Arch specific versions of structs in GetProperties() prior to + // initialization in InitAndroidArchModule, lets call it `generalProperties`. + // The outer index has the same order as generalProperties and the inner index + // chooses the props specific to the architecture. The interface{} value is an + // archPropRoot that is filled with arch specific values by the arch mutator. archProperties [][]interface{} // Properties specific to the Blueprint to BUILD migration. diff --git a/android/path_properties.go b/android/path_properties.go index 397688064..fdc4d918f 100644 --- a/android/path_properties.go +++ b/android/path_properties.go @@ -33,7 +33,7 @@ func registerPathDepsMutator(ctx RegisterMutatorsContext) { // The pathDepsMutator automatically adds dependencies on any module that is listed with the // ":module" module reference syntax in a property that is tagged with `android:"path"`. func pathDepsMutator(ctx BottomUpMutatorContext) { - props := ctx.Module().base().generalProperties + props := ctx.Module().base().GetProperties() addPathDepsForProps(ctx, props) } diff --git a/android/prebuilt.go b/android/prebuilt.go index 22aa94665..ade92f716 100644 --- a/android/prebuilt.go +++ b/android/prebuilt.go @@ -183,7 +183,6 @@ type PrebuiltSrcsSupplier func(ctx BaseModuleContext, prebuilt Module) []string func initPrebuiltModuleCommon(module PrebuiltInterface) *Prebuilt { p := module.Prebuilt() module.AddProperties(&p.properties) - module.base().generalProperties = module.GetProperties() return p } diff --git a/android/variable.go b/android/variable.go index 06a563add..bb295d53e 100644 --- a/android/variable.go +++ b/android/variable.go @@ -1029,7 +1029,7 @@ func (m *ModuleBase) setVariableProperties(ctx BottomUpMutatorContext, printfIntoProperties(ctx, prefix, productVariablePropertyValue, variableValue) - err := proptools.AppendMatchingProperties(m.generalProperties, + err := proptools.AppendMatchingProperties(m.GetProperties(), productVariablePropertyValue.Addr().Interface(), nil) if err != nil { if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {