Report creating modules in errors on created modules

Bug: 133172285
Change-Id: I0782c722f5877508691868f96dbf7dc0bed3f9f4
This commit is contained in:
Colin Cross 2019-05-20 13:55:14 -07:00
parent 7bcc256dac
commit 322cc01803
2 changed files with 11 additions and 0 deletions

View file

@ -173,6 +173,7 @@ type moduleInfo struct {
relBlueprintsFile string
pos scanner.Position
propertyPos map[string]scanner.Position
createdBy *moduleInfo
variantName string
variant variationMap
@ -215,6 +216,10 @@ func (module *moduleInfo) String() string {
if module.variantName != "" {
s += fmt.Sprintf(" variant %q", module.variantName)
}
if module.createdBy != nil {
s += fmt.Sprintf(" (created by %s)", module.createdBy)
}
return s
}
@ -2151,6 +2156,10 @@ func (c *Context) runMutator(config interface{}, mutator *mutatorInfo,
}
}
if module.createdBy != nil && module.createdBy.logicModule == nil {
module.createdBy = module.createdBy.splitModules[0]
}
// Add in any new direct dependencies that were added by the mutator
module.directDeps = append(module.directDeps, module.newDirectDeps...)
module.newDirectDeps = nil

View file

@ -923,6 +923,8 @@ func (mctx *mutatorContext) CreateModule(factory ModuleFactory, props ...interfa
module.relBlueprintsFile = mctx.module.relBlueprintsFile
module.pos = mctx.module.pos
module.propertyPos = mctx.module.propertyPos
module.createdBy = mctx.module
for _, p := range props {
err := proptools.AppendMatchingProperties(module.properties, p, nil)