aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-11-07 13:35:38 -0800
committerColin Cross <ccross@android.com>2017-11-07 13:36:44 -0800
commit5a79c8389373ca1f9f46198b5290795381fb6f9f (patch)
tree15708931e7a6daf3c9ad1ff452257a406e0620fc
parent99c6dfaecc2e0a2452a4142b533035aa52dbe6f2 (diff)
downloadbuild_soong-5a79c8389373ca1f9f46198b5290795381fb6f9f.tar.gz
build_soong-5a79c8389373ca1f9f46198b5290795381fb6f9f.tar.bz2
build_soong-5a79c8389373ca1f9f46198b5290795381fb6f9f.zip
Add presingletons
Plumb blueprint's presingletons through register.go. Test: m checkbuild Change-Id: I5bc0f311740c9220f7afdf2999e6f080f5b0c5ab
-rw-r--r--android/register.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/android/register.go b/android/register.go
index 51089f7b..81a266d7 100644
--- a/android/register.go
+++ b/android/register.go
@@ -31,6 +31,7 @@ type singleton struct {
}
var singletons []singleton
+var preSingletons []singleton
type mutator struct {
name string
@@ -60,6 +61,10 @@ func RegisterSingletonType(name string, factory blueprint.SingletonFactory) {
singletons = append(singletons, singleton{name, factory})
}
+func RegisterPreSingletonType(name string, factory blueprint.SingletonFactory) {
+ preSingletons = append(preSingletons, singleton{name, factory})
+}
+
type Context struct {
*blueprint.Context
}
@@ -69,6 +74,10 @@ func NewContext() *Context {
}
func (ctx *Context) Register() {
+ for _, t := range preSingletons {
+ ctx.RegisterPreSingletonType(t.name, t.factory)
+ }
+
for _, t := range moduleTypes {
ctx.RegisterModuleType(t.name, t.factory)
}