Add override_android_test.
This change also adds instrumentation_target_package to android_test, so that the target package name in a test manifest can be easily overridden. Fixes: 134624457 Test: app_test.go Change-Id: Ib8dd703da0038ac76210c92d79e133e37c718122
This commit is contained in:
@@ -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,10 +230,18 @@ 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
|
||||
@@ -237,6 +249,5 @@ func overridableModuleDepsMutator(ctx BottomUpMutatorContext) {
|
||||
// modules. Therefore, dependencies on overriding modules need to be forwarded there as well.
|
||||
ctx.ReplaceDependencies(o)
|
||||
}
|
||||
b.OverridablePropertiesDepsMutator(ctx)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user