Remove top down mutators
Top down mutators are no longer used in Soong!
Bug: 367784740
Test: builds
Change-Id: I26114a2412277b82edafc4dc5849c3688d184361
diff --git a/android/mutator.go b/android/mutator.go
index 76487fb..d6166d2 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -67,7 +67,6 @@
}
type RegisterMutatorsContext interface {
- TopDown(name string, m TopDownMutator) MutatorHandle
BottomUp(name string, m BottomUpMutator) MutatorHandle
BottomUpBlueprint(name string, m blueprint.BottomUpMutator) MutatorHandle
Transition(name string, m VariationTransitionMutator) TransitionMutatorHandle
@@ -195,17 +194,6 @@
finalDeps = append(finalDeps, f)
}
-type TopDownMutator func(TopDownMutatorContext)
-
-type TopDownMutatorContext interface {
- BaseModuleContext
-}
-
-type topDownMutatorContext struct {
- bp blueprint.TopDownMutatorContext
- baseModuleContext
-}
-
type BottomUpMutator func(BottomUpMutatorContext)
type BottomUpMutatorContext interface {
@@ -281,8 +269,8 @@
}
// An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module
-// for each transition mutator. bottomUpMutatorContext and topDownMutatorContext are created once for every module
-// for every BottomUp or TopDown mutator. Use a global pool for each to avoid reallocating every time.
+// for each transition mutator. bottomUpMutatorContext is created once for every module for every BottomUp mutator.
+// Use a global pool for each to avoid reallocating every time.
var (
outgoingTransitionContextPool = sync.Pool{
New: func() any { return &outgoingTransitionContextImpl{} },
@@ -293,10 +281,6 @@
bottomUpMutatorContextPool = sync.Pool{
New: func() any { return &bottomUpMutatorContext{} },
}
-
- topDownMutatorContextPool = sync.Pool{
- New: func() any { return &topDownMutatorContext{} },
- }
)
type bottomUpMutatorContext struct {
@@ -371,24 +355,6 @@
return name
}
-func (x *registerMutatorsContext) TopDown(name string, m TopDownMutator) MutatorHandle {
- f := func(ctx blueprint.TopDownMutatorContext) {
- if a, ok := ctx.Module().(Module); ok {
- moduleContext := a.base().baseModuleContextFactory(ctx)
- actx := topDownMutatorContextPool.Get().(*topDownMutatorContext)
- defer topDownMutatorContextPool.Put(actx)
- *actx = topDownMutatorContext{
- bp: ctx,
- baseModuleContext: moduleContext,
- }
- m(actx)
- }
- }
- mutator := &mutator{name: x.mutatorName(name), topDownMutator: f}
- x.mutators = append(x.mutators, mutator)
- return mutator
-}
-
func (mutator *mutator) componentName() string {
return mutator.name
}
@@ -398,8 +364,6 @@
var handle blueprint.MutatorHandle
if mutator.bottomUpMutator != nil {
handle = blueprintCtx.RegisterBottomUpMutator(mutator.name, mutator.bottomUpMutator)
- } else if mutator.topDownMutator != nil {
- handle = blueprintCtx.RegisterTopDownMutator(mutator.name, mutator.topDownMutator)
} else if mutator.transitionMutator != nil {
handle := blueprintCtx.RegisterTransitionMutator(mutator.name, mutator.transitionMutator)
if mutator.neverFar {
@@ -529,11 +493,11 @@
ctx.BottomUp("deps", depsMutator).UsesReverseDependencies()
}
-// android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that
+// android.bottomUpMutatorContext either has to embed blueprint.BottomUpMutatorContext, in which case every method that
// has an overridden version in android.BaseModuleContext has to be manually forwarded to BaseModuleContext to avoid
-// ambiguous method errors, or it has to store a blueprint.TopDownMutatorContext non-embedded, in which case every
+// ambiguous method errors, or it has to store a blueprint.BottomUpMutatorContext non-embedded, in which case every
// non-overridden method has to be forwarded. There are fewer non-overridden methods, so use the latter. The following
-// methods forward to the identical blueprint versions for topDownMutatorContext and bottomUpMutatorContext.
+// methods forward to the identical blueprint versions for bottomUpMutatorContext.
func (b *bottomUpMutatorContext) Rename(name string) {
b.bp.Rename(name)