add type to modules created by LoadHookContext
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: I3be5d259694a1540d21deb8a665ec7bea3464054
This commit is contained in:
@@ -59,6 +59,7 @@ func (t moduleType) register(ctx *Context) {
|
||||
|
||||
var moduleTypes []moduleType
|
||||
var moduleTypesForDocs = map[string]reflect.Value{}
|
||||
var moduleTypeByFactory = map[reflect.Value]string{}
|
||||
|
||||
type singleton struct {
|
||||
// True if this should be registered as a pre-singleton, false otherwise.
|
||||
@@ -140,6 +141,7 @@ func RegisterModuleType(name string, factory ModuleFactory) {
|
||||
// RegisterModuleType was a lambda.
|
||||
func RegisterModuleTypeForDocs(name string, factory reflect.Value) {
|
||||
moduleTypesForDocs[name] = factory
|
||||
moduleTypeByFactory[factory] = name
|
||||
}
|
||||
|
||||
func RegisterSingletonType(name string, factory SingletonFactory) {
|
||||
@@ -228,6 +230,10 @@ func ModuleTypeFactoriesForDocs() map[string]reflect.Value {
|
||||
return moduleTypesForDocs
|
||||
}
|
||||
|
||||
func ModuleTypeByFactory() map[reflect.Value]string {
|
||||
return moduleTypeByFactory
|
||||
}
|
||||
|
||||
// Interface for registering build components.
|
||||
//
|
||||
// Provided to allow registration of build components to be shared between the runtime
|
||||
|
Reference in New Issue
Block a user