Add a Name property am: fc754581fc

am: 8342688bca

Change-Id: I2013c8aadf3dacaa78a866f4178a23a00bc5aa39
This commit is contained in:
Colin Cross 2016-10-13 03:50:31 +00:00 committed by android-build-merger
commit 1a7847bd28
3 changed files with 28 additions and 7 deletions

View file

@ -80,7 +80,20 @@ func (d *DefaultsModule) properties() []interface{} {
}
func InitDefaultsModule(module Module, d Defaults, props ...interface{}) (blueprint.Module, []interface{}) {
return InitDefaultableModule(module, d, props...)
props = append(props,
&hostAndDeviceProperties{},
&commonProperties{},
&variableProperties{})
_, props = InitArchModule(module, props...)
_, props = InitDefaultableModule(module, d, props...)
props = append(props, &module.base().nameProperties)
module.base().module = module
return module, props
}
var _ Defaults = (*DefaultsModule)(nil)

View file

@ -99,9 +99,12 @@ type Module interface {
InstallInData() bool
}
type commonProperties struct {
type nameProperties struct {
// The name of the module. Must be unique across all modules.
Name string
Deps []string
}
type commonProperties struct {
Tags []string
// emit build rules for this module
@ -177,7 +180,10 @@ func InitAndroidModule(m Module,
base := m.base()
base.module = m
propertyStructs = append(propertyStructs, &base.commonProperties, &base.variableProperties)
propertyStructs = append(propertyStructs,
&base.nameProperties,
&base.commonProperties,
&base.variableProperties)
return m, propertyStructs
}
@ -250,6 +256,7 @@ type ModuleBase struct {
// the thing pattern to good use.
module Module
nameProperties nameProperties
commonProperties commonProperties
variableProperties variableProperties
hostAndDeviceProperties hostAndDeviceProperties
@ -270,6 +277,10 @@ type ModuleBase struct {
hooks hooks
}
func (a *ModuleBase) Name() string {
return a.nameProperties.Name
}
func (a *ModuleBase) base() *ModuleBase {
return a
}

View file

@ -935,9 +935,6 @@ func DefaultsFactory(props ...interface{}) (blueprint.Module, []interface{}) {
&InstallerProperties{},
)
_, props = android.InitAndroidArchModule(module, android.HostAndDeviceDefault,
android.MultilibDefault, props...)
return android.InitDefaultsModule(module, module, props...)
}