Make CreateModule return the newly created module
Allow mutators to modify properties of the newly created module
by returning it.
Test: m checkbuild
Change-Id: I682caca86c0c8f7c3ae815a494d4c75962c8e2e8
diff --git a/android/mutator.go b/android/mutator.go
index 7b7859c..510e63c 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -121,7 +121,7 @@
Rename(name string)
- CreateModule(ModuleFactory, ...interface{})
+ CreateModule(ModuleFactory, ...interface{}) Module
}
type topDownMutatorContext struct {
@@ -243,9 +243,10 @@
t.Module().base().commonProperties.DebugName = name
}
-func (t *topDownMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) {
+func (t *topDownMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
inherited := []interface{}{&t.Module().base().commonProperties, &t.Module().base().variableProperties}
- t.bp.CreateModule(ModuleFactoryAdaptor(factory), append(inherited, props...)...)
+ module := t.bp.CreateModule(ModuleFactoryAdaptor(factory), append(inherited, props...)...).(Module)
+ return module
}
func (b *bottomUpMutatorContext) MutatorName() string {