diff options
Diffstat (limited to 'android/override_module.go')
-rw-r--r-- | android/override_module.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/android/override_module.go b/android/override_module.go index 22fb7de44..09959e43d 100644 --- a/android/override_module.go +++ b/android/override_module.go @@ -175,6 +175,7 @@ func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) { ctx.TopDown("register_override", registerOverrideMutator).Parallel() ctx.BottomUp("perform_override", performOverrideMutator).Parallel() ctx.BottomUp("overridable_deps", overridableModuleDepsMutator).Parallel() + ctx.BottomUp("replace_deps_on_override", replaceDepsOnOverridingModuleMutator).Parallel() } type overrideBaseDependencyTag struct { @@ -218,6 +219,9 @@ func performOverrideMutator(ctx BottomUpMutatorContext) { variants[i+1] = o.(Module).Name() } mods := ctx.CreateLocalVariations(variants...) + // Make the original variation the default one to depend on if no other override module variant + // is specified. + ctx.AliasVariation(variants[0]) for i, o := range overrides { mods[i+1].(OverridableModule).override(ctx, o) } @@ -226,17 +230,24 @@ func performOverrideMutator(ctx BottomUpMutatorContext) { // variant name rule for overridden modules, and thus allows ReplaceDependencies to match the // two. ctx.CreateLocalVariations(o.Name()) + // To allow dependencies to be added without having to know the above variation. + ctx.AliasVariation(o.Name()) } } func overridableModuleDepsMutator(ctx BottomUpMutatorContext) { if b, ok := ctx.Module().(OverridableModule); ok { + b.OverridablePropertiesDepsMutator(ctx) + } +} + +func replaceDepsOnOverridingModuleMutator(ctx BottomUpMutatorContext) { + if b, ok := ctx.Module().(OverridableModule); ok { if o := b.getOverriddenBy(); o != "" { // Redirect dependencies on the overriding module to this overridden module. Overriding // modules are basically pseudo modules, and all build actions are associated to overridden // modules. Therefore, dependencies on overriding modules need to be forwarded there as well. ctx.ReplaceDependencies(o) } - b.OverridablePropertiesDepsMutator(ctx) } } |