aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/arch.go2
-rw-r--r--android/mutator.go6
-rw-r--r--register.go26
3 files changed, 18 insertions, 16 deletions
diff --git a/android/arch.go b/android/arch.go
index 5074c4cd..2d4ad2e4 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -26,7 +26,7 @@ import (
func init() {
RegisterBottomUpMutator("defaults_deps", defaultsDepsMutator).Parallel()
- RegisterTopDownMutator("defaults", defaultsMutator)
+ RegisterTopDownMutator("defaults", defaultsMutator).Parallel()
RegisterBottomUpMutator("arch", ArchMutator).Parallel()
}
diff --git a/android/mutator.go b/android/mutator.go
index c0cb3aaa..3d5a1772 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -44,7 +44,7 @@ type androidBottomUpMutatorContext struct {
androidBaseContextImpl
}
-func RegisterBottomUpMutator(name string, mutator AndroidBottomUpMutator) soong.BottomUpMutatorHandle {
+func RegisterBottomUpMutator(name string, mutator AndroidBottomUpMutator) soong.MutatorHandle {
return soong.RegisterBottomUpMutator(name, func(ctx blueprint.BottomUpMutatorContext) {
if a, ok := ctx.Module().(Module); ok {
actx := &androidBottomUpMutatorContext{
@@ -56,8 +56,8 @@ func RegisterBottomUpMutator(name string, mutator AndroidBottomUpMutator) soong.
})
}
-func RegisterTopDownMutator(name string, mutator AndroidTopDownMutator) {
- soong.RegisterTopDownMutator(name, func(ctx blueprint.TopDownMutatorContext) {
+func RegisterTopDownMutator(name string, mutator AndroidTopDownMutator) soong.MutatorHandle {
+ return soong.RegisterTopDownMutator(name, func(ctx blueprint.TopDownMutatorContext) {
if a, ok := ctx.Module().(Module); ok {
actx := &androidTopDownMutatorContext{
TopDownMutatorContext: ctx,
diff --git a/register.go b/register.go
index 5c74273d..2a1bd91c 100644
--- a/register.go
+++ b/register.go
@@ -47,21 +47,23 @@ func RegisterSingletonType(name string, factory blueprint.SingletonFactory) {
singletons = append(singletons, singleton{name, factory})
}
-func RegisterBottomUpMutator(name string, m blueprint.BottomUpMutator) BottomUpMutatorHandle {
+func RegisterBottomUpMutator(name string, m blueprint.BottomUpMutator) MutatorHandle {
mutator := &mutator{name: name, bottomUpMutator: m}
mutators = append(mutators, mutator)
return mutator
}
-func RegisterTopDownMutator(name string, m blueprint.TopDownMutator) {
- mutators = append(mutators, &mutator{name: name, topDownMutator: m})
+func RegisterTopDownMutator(name string, m blueprint.TopDownMutator) MutatorHandle {
+ mutator := &mutator{name: name, topDownMutator: m}
+ mutators = append(mutators, mutator)
+ return mutator
}
-type BottomUpMutatorHandle interface {
- Parallel() BottomUpMutatorHandle
+type MutatorHandle interface {
+ Parallel() MutatorHandle
}
-func (mutator *mutator) Parallel() BottomUpMutatorHandle {
+func (mutator *mutator) Parallel() MutatorHandle {
mutator.parallel = true
return mutator
}
@@ -78,14 +80,14 @@ func NewContext() *blueprint.Context {
}
for _, t := range mutators {
+ var handle blueprint.MutatorHandle
if t.bottomUpMutator != nil {
- handle := ctx.RegisterBottomUpMutator(t.name, t.bottomUpMutator)
- if t.parallel {
- handle.Parallel()
- }
+ handle = ctx.RegisterBottomUpMutator(t.name, t.bottomUpMutator)
+ } else if t.topDownMutator != nil {
+ handle = ctx.RegisterTopDownMutator(t.name, t.topDownMutator)
}
- if t.topDownMutator != nil {
- ctx.RegisterTopDownMutator(t.name, t.topDownMutator)
+ if t.parallel {
+ handle.Parallel()
}
}