Remove customizableProperties from android.ModuleBase
- customizableProperties was being used to access all properties, i.e. basically `GetProperties()` - generalProperties was a subset of properties, i.e. `initArchModule()` would only add new arch-specific properties to `customizableProperties` (and `archProperties`) but not `generalProperties` This PR sets generalProperties to contain all properties, which then makes customizableProperties redundant. And in arch.go, any iteration is done via `archProperties` instead. Bug: 206961391 Test: m nothing and diff the ninja files Change-Id: Ieb72b31c0a447fcbf34c92a04f002d7b9d777a86
This commit is contained in:
@@ -1036,9 +1036,7 @@ func initArchModule(m Module) {
|
|||||||
m.AddProperties(archProperties...)
|
m.AddProperties(archProperties...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the list of properties that can be set by a defaults module or a call to
|
base.generalProperties = m.GetProperties()
|
||||||
// AppendMatchingProperties or PrependMatchingProperties.
|
|
||||||
base.customizableProperties = m.GetProperties()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func maybeBlueprintEmbed(src reflect.Value) reflect.Value {
|
func maybeBlueprintEmbed(src reflect.Value) reflect.Value {
|
||||||
@@ -1111,7 +1109,7 @@ func getChildPropertyStruct(ctx ArchVariantContext,
|
|||||||
func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) {
|
func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) {
|
||||||
os := m.commonProperties.CompileOS
|
os := m.commonProperties.CompileOS
|
||||||
|
|
||||||
for i := range m.generalProperties {
|
for i := range m.archProperties {
|
||||||
genProps := m.generalProperties[i]
|
genProps := m.generalProperties[i]
|
||||||
if m.archProperties[i] == nil {
|
if m.archProperties[i] == nil {
|
||||||
continue
|
continue
|
||||||
@@ -1439,7 +1437,7 @@ func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) {
|
|||||||
arch := m.Arch()
|
arch := m.Arch()
|
||||||
os := m.Os()
|
os := m.Os()
|
||||||
|
|
||||||
for i := range m.generalProperties {
|
for i := range m.archProperties {
|
||||||
genProps := m.generalProperties[i]
|
genProps := m.generalProperties[i]
|
||||||
if m.archProperties[i] == nil {
|
if m.archProperties[i] == nil {
|
||||||
continue
|
continue
|
||||||
|
@@ -97,7 +97,7 @@ func InitDefaultableModule(module DefaultableModule) {
|
|||||||
|
|
||||||
module.AddProperties(module.defaults())
|
module.AddProperties(module.defaults())
|
||||||
|
|
||||||
module.base().customizableProperties = module.GetProperties()
|
module.base().generalProperties = module.GetProperties()
|
||||||
}
|
}
|
||||||
|
|
||||||
// A restricted subset of context methods, similar to LoadHookContext.
|
// A restricted subset of context methods, similar to LoadHookContext.
|
||||||
|
@@ -68,7 +68,7 @@ func (l *loadHookContext) moduleFactories() map[string]blueprint.ModuleFactory {
|
|||||||
func (l *loadHookContext) appendPrependHelper(props []interface{},
|
func (l *loadHookContext) appendPrependHelper(props []interface{},
|
||||||
extendFn func([]interface{}, interface{}, proptools.ExtendPropertyFilterFunc) error) {
|
extendFn func([]interface{}, interface{}, proptools.ExtendPropertyFilterFunc) error) {
|
||||||
for _, p := range props {
|
for _, p := range props {
|
||||||
err := extendFn(l.Module().base().customizableProperties, p, nil)
|
err := extendFn(l.Module().base().generalProperties, p, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
|
||||||
l.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
|
l.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
|
||||||
|
@@ -81,7 +81,6 @@ func LicenseFactory() Module {
|
|||||||
module.AddProperties(&base.nameProperties, &module.properties)
|
module.AddProperties(&base.nameProperties, &module.properties)
|
||||||
|
|
||||||
base.generalProperties = module.GetProperties()
|
base.generalProperties = module.GetProperties()
|
||||||
base.customizableProperties = module.GetProperties()
|
|
||||||
|
|
||||||
// The visibility property needs to be checked and parsed by the visibility module.
|
// The visibility property needs to be checked and parsed by the visibility module.
|
||||||
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
|
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
|
||||||
|
@@ -54,7 +54,6 @@ func LicenseKindFactory() Module {
|
|||||||
module.AddProperties(&base.nameProperties, &module.properties)
|
module.AddProperties(&base.nameProperties, &module.properties)
|
||||||
|
|
||||||
base.generalProperties = module.GetProperties()
|
base.generalProperties = module.GetProperties()
|
||||||
base.customizableProperties = module.GetProperties()
|
|
||||||
|
|
||||||
// The visibility property needs to be checked and parsed by the visibility module.
|
// The visibility property needs to be checked and parsed by the visibility module.
|
||||||
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
|
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
|
||||||
|
@@ -780,7 +780,6 @@ func newMockLicensesBadModule() Module {
|
|||||||
m.AddProperties(&base.nameProperties, &m.properties)
|
m.AddProperties(&base.nameProperties, &m.properties)
|
||||||
|
|
||||||
base.generalProperties = m.GetProperties()
|
base.generalProperties = m.GetProperties()
|
||||||
base.customizableProperties = m.GetProperties()
|
|
||||||
|
|
||||||
// The default_visibility property needs to be checked and parsed by the visibility module during
|
// 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.
|
// its checking and parsing phases so make it the primary visibility property.
|
||||||
|
@@ -1033,7 +1033,6 @@ func InitAndroidModule(m Module) {
|
|||||||
initProductVariableModule(m)
|
initProductVariableModule(m)
|
||||||
|
|
||||||
base.generalProperties = m.GetProperties()
|
base.generalProperties = m.GetProperties()
|
||||||
base.customizableProperties = m.GetProperties()
|
|
||||||
|
|
||||||
// The default_visibility property needs to be checked and parsed by the visibility module during
|
// 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.
|
// its checking and parsing phases so make it the primary visibility property.
|
||||||
@@ -1217,8 +1216,6 @@ type ModuleBase struct {
|
|||||||
// filled with arch specific values by the arch mutator.
|
// filled with arch specific values by the arch mutator.
|
||||||
archProperties [][]interface{}
|
archProperties [][]interface{}
|
||||||
|
|
||||||
customizableProperties []interface{}
|
|
||||||
|
|
||||||
// Properties specific to the Blueprint to BUILD migration.
|
// Properties specific to the Blueprint to BUILD migration.
|
||||||
bazelTargetModuleProperties bazel.BazelTargetModuleProperties
|
bazelTargetModuleProperties bazel.BazelTargetModuleProperties
|
||||||
|
|
||||||
|
@@ -183,7 +183,7 @@ type PrebuiltSrcsSupplier func(ctx BaseModuleContext, prebuilt Module) []string
|
|||||||
func initPrebuiltModuleCommon(module PrebuiltInterface) *Prebuilt {
|
func initPrebuiltModuleCommon(module PrebuiltInterface) *Prebuilt {
|
||||||
p := module.Prebuilt()
|
p := module.Prebuilt()
|
||||||
module.AddProperties(&p.properties)
|
module.AddProperties(&p.properties)
|
||||||
module.base().customizableProperties = module.GetProperties()
|
module.base().generalProperties = module.GetProperties()
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user