Bläddra i källkod

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
Usta 2 år sedan
förälder
incheckning
851a3271ce

+ 5 - 8
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]

+ 0 - 2
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.

+ 1 - 1
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())

+ 0 - 2
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)
 

+ 0 - 2
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)
 

+ 0 - 2
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)

+ 5 - 8
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.

+ 1 - 1
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)
 }
 

+ 0 - 1
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
 }
 

+ 1 - 1
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 {