Make CreateModule take an android.ModuleFactory
Reduce the boilerplate required to call CreateModule by taking an android.ModuleFactory instead of a blueprint.ModuleFactory. Test: m checkbuild Change-Id: I1259d2dd3f7893b5319c333bc180727ac40f9e91
This commit is contained in:
@@ -30,7 +30,7 @@ type LoadHookContext interface {
|
||||
BaseModuleContext
|
||||
AppendProperties(...interface{})
|
||||
PrependProperties(...interface{})
|
||||
CreateModule(blueprint.ModuleFactory, ...interface{})
|
||||
CreateModule(ModuleFactory, ...interface{})
|
||||
}
|
||||
|
||||
// Arch hooks are run after the module has been split into architecture variants, and can be used
|
||||
|
@@ -121,7 +121,7 @@ type TopDownMutatorContext interface {
|
||||
|
||||
Rename(name string)
|
||||
|
||||
CreateModule(blueprint.ModuleFactory, ...interface{})
|
||||
CreateModule(ModuleFactory, ...interface{})
|
||||
}
|
||||
|
||||
type topDownMutatorContext struct {
|
||||
@@ -243,9 +243,9 @@ func (t *topDownMutatorContext) Rename(name string) {
|
||||
t.Module().base().commonProperties.DebugName = name
|
||||
}
|
||||
|
||||
func (t *topDownMutatorContext) CreateModule(factory blueprint.ModuleFactory, props ...interface{}) {
|
||||
func (t *topDownMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) {
|
||||
inherited := []interface{}{&t.Module().base().commonProperties, &t.Module().base().variableProperties}
|
||||
t.bp.CreateModule(factory, append(inherited, props...)...)
|
||||
t.bp.CreateModule(ModuleFactoryAdaptor(factory), append(inherited, props...)...)
|
||||
}
|
||||
|
||||
func (b *bottomUpMutatorContext) MutatorName() string {
|
||||
|
@@ -82,7 +82,7 @@ func createImport(mctx android.TopDownMutatorContext, module string, scope strin
|
||||
props.Sdk_version = proptools.StringPtr("current")
|
||||
props.Installable = proptools.BoolPtr(false)
|
||||
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(ImportFactory), &props)
|
||||
mctx.CreateModule(ImportFactory, &props)
|
||||
}
|
||||
|
||||
func createFilegroup(mctx android.TopDownMutatorContext, module string, scope string, apiver string, path string) {
|
||||
@@ -93,7 +93,7 @@ func createFilegroup(mctx android.TopDownMutatorContext, module string, scope st
|
||||
}{}
|
||||
filegroupProps.Name = proptools.StringPtr(fgName)
|
||||
filegroupProps.Srcs = []string{path}
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(android.FileGroupFactory), &filegroupProps)
|
||||
mctx.CreateModule(android.FileGroupFactory, &filegroupProps)
|
||||
}
|
||||
|
||||
func getPrebuiltFiles(mctx android.TopDownMutatorContext, name string) []string {
|
||||
|
@@ -422,7 +422,7 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiSc
|
||||
props.Product_specific = proptools.BoolPtr(true)
|
||||
}
|
||||
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory), &props)
|
||||
mctx.CreateModule(LibraryFactory, &props)
|
||||
}
|
||||
|
||||
// Creates a droiddoc module that creates stubs source files from the given full source
|
||||
@@ -522,7 +522,7 @@ func (module *SdkLibrary) createDocs(mctx android.LoadHookContext, apiScope apiS
|
||||
module.latestRemovedApiFilegroupName(apiScope))
|
||||
props.Check_api.Ignore_missing_latest_api = proptools.BoolPtr(true)
|
||||
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(DroidstubsFactory), &props)
|
||||
mctx.CreateModule(DroidstubsFactory, &props)
|
||||
}
|
||||
|
||||
// Creates the xml file that publicizes the runtime library
|
||||
@@ -560,7 +560,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) {
|
||||
genruleProps.Name = proptools.StringPtr(module.xmlFileName() + "-gen")
|
||||
genruleProps.Cmd = proptools.StringPtr("echo '" + xmlContent + "' > $(out)")
|
||||
genruleProps.Out = []string{module.xmlFileName()}
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(genrule.GenRuleFactory), &genruleProps)
|
||||
mctx.CreateModule(genrule.GenRuleFactory, &genruleProps)
|
||||
|
||||
// creates a prebuilt_etc module to actually place the xml file under
|
||||
// <partition>/etc/permissions
|
||||
@@ -582,7 +582,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) {
|
||||
} else if module.ProductSpecific() {
|
||||
etcProps.Product_specific = proptools.BoolPtr(true)
|
||||
}
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory), &etcProps)
|
||||
mctx.CreateModule(android.PrebuiltEtcFactory, &etcProps)
|
||||
}
|
||||
|
||||
func (module *SdkLibrary) PrebuiltJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths {
|
||||
@@ -815,7 +815,7 @@ func (module *sdkLibraryImport) createInternalModules(mctx android.LoadHookConte
|
||||
props.Product_specific = proptools.BoolPtr(true)
|
||||
}
|
||||
|
||||
mctx.CreateModule(android.ModuleFactoryAdaptor(ImportFactory), &props, &module.properties)
|
||||
mctx.CreateModule(ImportFactory, &props, &module.properties)
|
||||
|
||||
javaSdkLibraries := javaSdkLibraries(mctx.Config())
|
||||
javaSdkLibrariesLock.Lock()
|
||||
|
@@ -362,7 +362,7 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
||||
ccProps.Recovery_available = m.properties.Recovery_available
|
||||
ccProps.Vendor_available = m.properties.Vendor_available
|
||||
|
||||
ctx.CreateModule(android.ModuleFactoryAdaptor(cc.LibraryFactory), &ccProps)
|
||||
ctx.CreateModule(cc.LibraryFactory, &ccProps)
|
||||
|
||||
// internal scope contains all properties
|
||||
// public scope only contains public properties
|
||||
@@ -390,7 +390,7 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
||||
Name: proptools.StringPtr(m.javaGenModuleName()),
|
||||
}
|
||||
|
||||
ctx.CreateModule(android.ModuleFactoryAdaptor(syspropJavaGenFactory), &javaGenProps)
|
||||
ctx.CreateModule(syspropJavaGenFactory, &javaGenProps)
|
||||
|
||||
javaProps := struct {
|
||||
Name *string
|
||||
@@ -413,7 +413,7 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
||||
javaProps.Sdk_version = proptools.StringPtr("core_current")
|
||||
javaProps.Libs = []string{stub}
|
||||
|
||||
ctx.CreateModule(android.ModuleFactoryAdaptor(java.LibraryFactory), &javaProps)
|
||||
ctx.CreateModule(java.LibraryFactory, &javaProps)
|
||||
}
|
||||
|
||||
func syspropDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
Reference in New Issue
Block a user