From 4102666b99cc911fbfd7afcd594a6648cc8c8d87 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 6 May 2021 11:59:38 -0700 Subject: [PATCH] Remove registerOverrideMutator registerOverrideMutator is no longer necessary, the new dependency is returned in overrideModuleDepsMutator and can be immediately acted upon. Test: TestOverrideAndroidApp Change-Id: I82237bad88ccb1d9564e17512c948e770581823f --- android/override_module.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/android/override_module.go b/android/override_module.go index 0a7e29491..e72cb787a 100644 --- a/android/override_module.go +++ b/android/override_module.go @@ -213,7 +213,6 @@ func (b *OverridableModuleBase) OverridablePropertiesDepsMutator(ctx BottomUpMut // to keep them in this order and not put any order mutators between them. func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) { ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel() - ctx.TopDown("register_override", registerOverrideMutator).Parallel() ctx.BottomUp("perform_override", performOverrideMutator).Parallel() // overridableModuleDepsMutator calls OverridablePropertiesDepsMutator so that overridable modules can // add deps from overridable properties. @@ -253,20 +252,11 @@ func overrideModuleDepsMutator(ctx BottomUpMutatorContext) { return } }) - ctx.AddDependency(ctx.Module(), overrideBaseDepTag, *module.getOverrideModuleProperties().Base) - } -} - -// Visits the base module added as a dependency above, checks the module type, and registers the -// overriding module. -func registerOverrideMutator(ctx TopDownMutatorContext) { - ctx.VisitDirectDepsWithTag(overrideBaseDepTag, func(base Module) { - if o, ok := base.(OverridableModule); ok { + baseModule := ctx.AddDependency(ctx.Module(), overrideBaseDepTag, *module.getOverrideModuleProperties().Base)[0] + if o, ok := baseModule.(OverridableModule); ok { o.addOverride(ctx.Module().(OverrideModule)) - } else { - ctx.PropertyErrorf("base", "unsupported base module type") } - }) + } } // Now, goes through all overridable modules, finds all modules overriding them, creates a local