Make all Nameless modules have unique names
Nameless modules still have to have unique names to avoid collisions when sorting by name. Give them all pointer suffixes, and rename NamelessModule to NamespacelessModule Fixes: 235475711 Test: soong_config_modules_test.go Change-Id: Ib2d34e8bcbb4f988bf00c1012511494f54d9a53e
This commit is contained in:
@@ -166,10 +166,10 @@ func (r *NameResolver) findNamespace(path string) (namespace *Namespace) {
|
|||||||
return namespace
|
return namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
// A NamelessModule can never be looked up by name. It must still implement Name(), but the return
|
// A NamespacelessModule can never be looked up by name. It must still implement Name(), and the name
|
||||||
// value doesn't have to be unique.
|
// still has to be unique.
|
||||||
type NamelessModule interface {
|
type NamespacelessModule interface {
|
||||||
Nameless()
|
Namespaceless()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *NameResolver) NewModule(ctx blueprint.NamespaceContext, moduleGroup blueprint.ModuleGroup, module blueprint.Module) (namespace blueprint.Namespace, errs []error) {
|
func (r *NameResolver) NewModule(ctx blueprint.NamespaceContext, moduleGroup blueprint.ModuleGroup, module blueprint.Module) (namespace blueprint.Namespace, errs []error) {
|
||||||
@@ -183,7 +183,7 @@ func (r *NameResolver) NewModule(ctx blueprint.NamespaceContext, moduleGroup blu
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := module.(NamelessModule); ok {
|
if _, ok := module.(NamespacelessModule); ok {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -172,7 +172,7 @@ func (m *soongConfigModuleTypeImport) Name() string {
|
|||||||
"soong_config_module_type_import_" + fmt.Sprintf("%p", m)
|
"soong_config_module_type_import_" + fmt.Sprintf("%p", m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*soongConfigModuleTypeImport) Nameless() {}
|
func (*soongConfigModuleTypeImport) Namespaceless() {}
|
||||||
func (*soongConfigModuleTypeImport) GenerateAndroidBuildActions(ModuleContext) {}
|
func (*soongConfigModuleTypeImport) GenerateAndroidBuildActions(ModuleContext) {}
|
||||||
|
|
||||||
// Create dummy modules for soong_config_module_type and soong_config_*_variable
|
// Create dummy modules for soong_config_module_type and soong_config_*_variable
|
||||||
@@ -279,9 +279,9 @@ func SoongConfigModuleTypeFactory() Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *soongConfigModuleTypeModule) Name() string {
|
func (m *soongConfigModuleTypeModule) Name() string {
|
||||||
return m.properties.Name
|
return m.properties.Name + fmt.Sprintf("%p", m)
|
||||||
}
|
}
|
||||||
func (*soongConfigModuleTypeModule) Nameless() {}
|
func (*soongConfigModuleTypeModule) Namespaceless() {}
|
||||||
func (*soongConfigModuleTypeModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
func (*soongConfigModuleTypeModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
||||||
|
|
||||||
type soongConfigStringVariableDummyModule struct {
|
type soongConfigStringVariableDummyModule struct {
|
||||||
@@ -314,15 +314,15 @@ func SoongConfigBoolVariableDummyFactory() Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *soongConfigStringVariableDummyModule) Name() string {
|
func (m *soongConfigStringVariableDummyModule) Name() string {
|
||||||
return m.properties.Name
|
return m.properties.Name + fmt.Sprintf("%p", m)
|
||||||
}
|
}
|
||||||
func (*soongConfigStringVariableDummyModule) Nameless() {}
|
func (*soongConfigStringVariableDummyModule) Namespaceless() {}
|
||||||
func (*soongConfigStringVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
func (*soongConfigStringVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
||||||
|
|
||||||
func (m *soongConfigBoolVariableDummyModule) Name() string {
|
func (m *soongConfigBoolVariableDummyModule) Name() string {
|
||||||
return m.properties.Name
|
return m.properties.Name + fmt.Sprintf("%p", m)
|
||||||
}
|
}
|
||||||
func (*soongConfigBoolVariableDummyModule) Nameless() {}
|
func (*soongConfigBoolVariableDummyModule) Namespaceless() {}
|
||||||
func (*soongConfigBoolVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
func (*soongConfigBoolVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
||||||
|
|
||||||
// importModuleTypes registers the module factories for a list of module types defined
|
// importModuleTypes registers the module factories for a list of module types defined
|
||||||
|
Reference in New Issue
Block a user