Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 851a3271 authored by Usta's avatar Usta Committed by Usta Shrestha
Browse files

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
parent e508f6a5
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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)

Loading