Dedup prebuilt mutator registration

Test: m checkbuild
Bug: 146540677
Change-Id: I9f8a11adf61fe6f352ec1eabc7c5bac332348ba2
This commit is contained in:
Paul Duffin 2019-12-19 15:11:53 +00:00
parent 77980a8bb9
commit 0c4979bbdf
7 changed files with 11 additions and 22 deletions

View File

@ -25,6 +25,11 @@ import (
// This file implements common functionality for handling modules that may exist as prebuilts,
// source, or both.
func RegisterPrebuiltMutators(ctx RegistrationContext) {
ctx.PreArchMutators(RegisterPrebuiltsPreArchMutators)
ctx.PostDepsMutators(RegisterPrebuiltsPostDepsMutators)
}
type prebuiltDependencyTag struct {
blueprint.BaseDependencyTag
}

View File

@ -141,8 +141,7 @@ func TestPrebuilts(t *testing.T) {
config := TestConfig(buildDir, nil, bp, fs)
ctx := NewTestContext()
ctx.PreArchMutators(RegisterPrebuiltsPreArchMutators)
ctx.PostDepsMutators(RegisterPrebuiltsPostDepsMutators)
RegisterPrebuiltMutators(ctx)
ctx.RegisterModuleType("filegroup", FileGroupFactory)
ctx.RegisterModuleType("prebuilt", newPrebuiltModule)
ctx.RegisterModuleType("source", newSourceModule)

View File

@ -305,16 +305,10 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
java.RegisterAppBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel()
})
android.RegisterPrebuiltMutators(ctx)
ctx.PreDepsMutators(RegisterPreDepsMutators)
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
ctx.PostDepsMutators(RegisterPostDepsMutators)
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.TopDown("prebuilt_select", android.PrebuiltSelectModuleMutator).Parallel()
ctx.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel()
})
ctx.Register(config)

View File

@ -74,8 +74,7 @@ func TestPrebuilt(t *testing.T) {
RegisterPrebuiltBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PostDepsMutators(android.RegisterPrebuiltsPostDepsMutators)
android.RegisterPrebuiltMutators(ctx)
ctx.Register(config)

View File

@ -74,8 +74,7 @@ func testContext() *android.TestContext {
RegisterDocsBuildComponents(ctx)
RegisterStubsBuildComponents(ctx)
RegisterSdkLibraryBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)
android.RegisterPrebuiltMutators(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
RegisterPrebuiltApisBuildComponents(ctx)

View File

@ -68,13 +68,7 @@ func testSdkContext(bp string, fs map[string][]byte) (*android.TestContext, andr
ctx.PreArchMutators(android.RegisterVisibilityRuleGatherer)
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("prebuilts", android.PrebuiltMutator).Parallel()
})
ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.TopDown("prebuilt_select", android.PrebuiltSelectModuleMutator).Parallel()
ctx.BottomUp("prebuilt_postdeps", android.PrebuiltPostDepsMutator).Parallel()
})
android.RegisterPrebuiltMutators(ctx)
ctx.RegisterModuleType("package", android.PackageFactory)
// from java package

View File

@ -60,8 +60,7 @@ func testContext(config android.Config) *android.TestContext {
java.RegisterAppBuildComponents(ctx)
java.RegisterSystemModulesBuildComponents(ctx)
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)
android.RegisterPrebuiltMutators(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
ctx.PreArchMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("sysprop_deps", syspropDepsMutator).Parallel()