Refactor factories
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.
Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
diff --git a/genrule/filegroup.go b/genrule/filegroup.go
index 71c5439..4029134 100644
--- a/genrule/filegroup.go
+++ b/genrule/filegroup.go
@@ -15,8 +15,6 @@
package genrule
import (
- "github.com/google/blueprint"
-
"android/soong/android"
)
@@ -48,10 +46,11 @@
// filegroup modules contain a list of files, and can be used to export files across package
// boundaries. filegroups (and genrules) can be referenced from srcs properties of other modules
// using the syntax ":module".
-func FileGroupFactory() (blueprint.Module, []interface{}) {
+func FileGroupFactory() android.Module {
module := &fileGroup{}
-
- return android.InitAndroidModule(module, &module.properties)
+ module.AddProperties(&module.properties)
+ android.InitAndroidModule(module)
+ return module
}
func (fg *fileGroup) DepsMutator(ctx android.BottomUpMutatorContext) {
diff --git a/genrule/genrule.go b/genrule/genrule.go
index dc4e968..c5de1fd 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -268,17 +268,20 @@
}
}
-func generatorFactory(tasks taskFunc, props ...interface{}) (blueprint.Module, []interface{}) {
+func generatorFactory(tasks taskFunc, props ...interface{}) android.Module {
module := &generator{
tasks: tasks,
}
- props = append(props, &module.properties)
+ module.AddProperties(props...)
+ module.AddProperties(&module.properties)
- return android.InitAndroidModule(module, props...)
+ android.InitAndroidModule(module)
+
+ return module
}
-func GenSrcsFactory() (blueprint.Module, []interface{}) {
+func GenSrcsFactory() android.Module {
properties := &genSrcsProperties{}
tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {
@@ -300,7 +303,7 @@
Output_extension string
}
-func GenRuleFactory() (blueprint.Module, []interface{}) {
+func GenRuleFactory() android.Module {
properties := &genRuleProperties{}
tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask {