Merge "force LoadHookContext to specify module type" am: 310b0cec5d am: e1c02fcc8f

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2018479

Change-Id: I5530afd6555cf0dc44e91517957d64f5363f5d27
This commit is contained in:
Treehugger Robot 2022-03-11 00:27:08 +00:00 committed by Automerger Merge Worker
commit 92d62e820c

View file

@ -1288,20 +1288,21 @@ type LoadHookContext interface {
// CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
// the specified property structs to it as if the properties were set in a blueprint file.
CreateModule(ModuleFactory, ...interface{}) Module
CreateModule(ModuleFactory, string, ...interface{}) Module
// RegisterScopedModuleType creates a new module type that is scoped to the current Blueprints
// file.
RegisterScopedModuleType(name string, factory ModuleFactory)
}
func (l *loadHookContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
func (l *loadHookContext) CreateModule(factory ModuleFactory, typeName string, props ...interface{}) Module {
module := newModule(factory)
module.relBlueprintsFile = l.module.relBlueprintsFile
module.pos = l.module.pos
module.propertyPos = l.module.propertyPos
module.createdBy = l.module
module.typeName = typeName
for _, p := range props {
err := proptools.AppendMatchingProperties(module.properties, p, nil)