diff options
author | Sam Delmerico <delmerico@google.com> | 2022-03-09 20:50:48 +0000 |
---|---|---|
committer | Sam Delmerico <delmerico@google.com> | 2022-03-09 20:50:48 +0000 |
commit | 518966d09eef712aec949833448808e8de2a496f (patch) | |
tree | acd45edfee11db7264f9da956f5af83dd9e1bd8c | |
parent | 5860caea339440f1040ee841c4e6bcfb4fd286ea (diff) | |
download | blueprint-518966d09eef712aec949833448808e8de2a496f.tar.gz |
force LoadHookContext to specify module type
Modules created by a LoadHookContext do not currently set a module type
when creating new modules, but it would make analysis of the
module-graph.json much easier if this module type information was available.
Bug: 174879786
Test: m json-module-graph && check that module which previously had a
blank module type now have the field populated
Change-Id: Ie2fa4244113b6254e6678da9a663d883e2a48a41
-rw-r--r-- | module_ctx.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/module_ctx.go b/module_ctx.go index 5d2b39b..2565bb9 100644 --- a/module_ctx.go +++ b/module_ctx.go @@ -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) |