diff options
author | Colin Cross <ccross@android.com> | 2017-06-23 15:06:31 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-06-30 21:08:36 +0000 |
commit | 36242850fdad11b4e6fbe061ef30f62e7e8c08d8 (patch) | |
tree | a3ca380533afd39e733c658560f87effb1ee0a46 /genrule | |
parent | 48173891485a22c9cab0e48f90a3a23be212f44a (diff) | |
download | build_soong-36242850fdad11b4e6fbe061ef30f62e7e8c08d8.tar.gz build_soong-36242850fdad11b4e6fbe061ef30f62e7e8c08d8.tar.bz2 build_soong-36242850fdad11b4e6fbe061ef30f62e7e8c08d8.zip |
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
Diffstat (limited to 'genrule')
-rw-r--r-- | genrule/filegroup.go | 9 | ||||
-rw-r--r-- | genrule/genrule.go | 13 |
2 files changed, 12 insertions, 10 deletions
diff --git a/genrule/filegroup.go b/genrule/filegroup.go index 71c54399..40291347 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 @@ var _ android.SourceFileProducer = (*fileGroup)(nil) // 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 dc4e9683..c5de1fdc 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -268,17 +268,20 @@ func (g *generator) generateSourceFile(ctx android.ModuleContext, task generateT } } -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 @@ type genSrcsProperties struct { Output_extension string } -func GenRuleFactory() (blueprint.Module, []interface{}) { +func GenRuleFactory() android.Module { properties := &genRuleProperties{} tasks := func(ctx android.ModuleContext, srcFiles android.Paths) []generateTask { |