Merge "Update CreateModule to require a type name" am: 5208ee885c am: 6d5c00183d am: fdf38ed489

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

Change-Id: Ieb04d341fa7d2127053212babe905a21ff7e358a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-04-27 17:56:12 +00:00 committed by Automerger Merge Worker
commit adedb1025c
2 changed files with 6 additions and 5 deletions

View file

@ -461,17 +461,17 @@ func createTestMutator(ctx TopDownMutatorContext) {
Deps []string
}
ctx.CreateModule(newBarModule, &props{
ctx.CreateModule(newBarModule, "new_bar", &props{
Name: "B",
Deps: []string{"D"},
})
ctx.CreateModule(newBarModule, &props{
ctx.CreateModule(newBarModule, "new_bar", &props{
Name: "C",
Deps: []string{"D"},
})
ctx.CreateModule(newFooModule, &props{
ctx.CreateModule(newFooModule, "new_foo", &props{
Name: "D",
})
}

View file

@ -836,7 +836,7 @@ type TopDownMutatorContext 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
}
type BottomUpMutatorContext interface {
@ -1201,13 +1201,14 @@ func (mctx *mutatorContext) Rename(name string) {
mctx.rename = append(mctx.rename, rename{mctx.module.group, name})
}
func (mctx *mutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
func (mctx *mutatorContext) CreateModule(factory ModuleFactory, typeName string, props ...interface{}) Module {
module := newModule(factory)
module.relBlueprintsFile = mctx.module.relBlueprintsFile
module.pos = mctx.module.pos
module.propertyPos = mctx.module.propertyPos
module.createdBy = mctx.module
module.typeName = typeName
for _, p := range props {
err := proptools.AppendMatchingProperties(module.properties, p, nil)