summaryrefslogtreecommitdiff
path: root/android/mutator.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-10-07 15:05:23 -0700
committer Colin Cross <ccross@android.com> 2024-10-07 20:12:40 -0700
commitb2388e3e3d67ab20292ada184bfbeb32d65d7d4c (patch)
tree63cdf7c1a2605ba9dba49ef7a6eb111905cdfc80 /android/mutator.go
parentd224fcab8b898f2cd68b10360a1e3aa17d46ba09 (diff)
Remove unused TopDownMutatorContext methods
Remove methods on TopDownMutatorContext that are no longer used. This deletes everything unique to BaseMutatorContext, so delete that too and replace it with BaseModuleContext. Bug: 367784740 Test: builds Flag: EXEMPT refactor Change-Id: Id37c7b7e3d46d75afaf7752862b08f766217f08b
Diffstat (limited to 'android/mutator.go')
-rw-r--r--android/mutator.go53
1 files changed, 10 insertions, 43 deletions
diff --git a/android/mutator.go b/android/mutator.go
index 8265458ba..ebe03a4d4 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -192,25 +192,10 @@ func FinalDepsMutators(f RegisterMutatorFunc) {
finalDeps = append(finalDeps, f)
}
-type BaseMutatorContext interface {
- BaseModuleContext
-
- // MutatorName returns the name that this mutator was registered with.
- MutatorName() string
-
- // Rename all variants of a module. The new name is not visible to calls to ModuleName,
- // AddDependency or OtherModuleName until after this mutator pass is complete.
- Rename(name string)
-
- // CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
- // the specified property structs to it as if the properties were set in a blueprint file.
- CreateModule(ModuleFactory, ...interface{}) Module
-}
-
type TopDownMutator func(TopDownMutatorContext)
type TopDownMutatorContext interface {
- BaseMutatorContext
+ BaseModuleContext
}
type topDownMutatorContext struct {
@@ -221,7 +206,7 @@ type topDownMutatorContext struct {
type BottomUpMutator func(BottomUpMutatorContext)
type BottomUpMutatorContext interface {
- BaseMutatorContext
+ BaseModuleContext
// AddDependency adds a dependency to the given module. It returns a slice of modules for each
// dependency (some entries may be nil).
@@ -285,6 +270,14 @@ type BottomUpMutatorContext interface {
// as long as the supplied predicate returns true.
// Replacements don't take effect until after the mutator pass is finished.
ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate)
+
+ // Rename all variants of a module. The new name is not visible to calls to ModuleName,
+ // AddDependency or OtherModuleName until after this mutator pass is complete.
+ Rename(name string)
+
+ // CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
+ // the specified property structs to it as if the properties were set in a blueprint file.
+ CreateModule(ModuleFactory, ...interface{}) Module
}
// An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module
@@ -669,32 +662,6 @@ func registerDepsMutator(ctx RegisterMutatorsContext) {
// 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.
-func (t *topDownMutatorContext) MutatorName() string {
- return t.bp.MutatorName()
-}
-
-func (t *topDownMutatorContext) Rename(name string) {
- t.bp.Rename(name)
- t.Module().base().commonProperties.DebugName = name
-}
-
-func (t *topDownMutatorContext) createModule(factory blueprint.ModuleFactory, name string, props ...interface{}) blueprint.Module {
- return t.bp.CreateModule(factory, name, props...)
-}
-
-func (t *topDownMutatorContext) CreateModule(factory ModuleFactory, props ...interface{}) Module {
- return createModule(t, factory, "_topDownMutatorModule", props...)
-}
-
-func (t *topDownMutatorContext) createModuleWithoutInheritance(factory ModuleFactory, props ...interface{}) Module {
- module := t.bp.CreateModule(ModuleFactoryAdaptor(factory), "", props...).(Module)
- return module
-}
-
-func (b *bottomUpMutatorContext) MutatorName() string {
- return b.bp.MutatorName()
-}
-
func (b *bottomUpMutatorContext) Rename(name string) {
b.bp.Rename(name)
b.Module().base().commonProperties.DebugName = name