summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2019-12-19 15:11:53 +0000
committer Paul Duffin <paulduffin@google.com> 2019-12-19 19:19:40 +0000
commit0c4979bbdf7f054f6f44be5bed1f5432dbbc33e6 (patch)
treebd7ee2c29417d83633c351981ddd9dafea8d6c93
parent77980a8bb9e86cbd847181e2f5d53b06a987cae8 (diff)
Dedup prebuilt mutator registration
Test: m checkbuild Bug: 146540677 Change-Id: I9f8a11adf61fe6f352ec1eabc7c5bac332348ba2
-rw-r--r--android/prebuilt.go5
-rw-r--r--android/prebuilt_test.go3
-rw-r--r--apex/apex_test.go8
-rw-r--r--cc/prebuilt_test.go3
-rw-r--r--java/java_test.go3
-rw-r--r--sdk/testing.go8
-rw-r--r--sysprop/sysprop_test.go3
7 files changed, 11 insertions, 22 deletions
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 0ee1201a7..2c99f1f7a 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -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
}
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index 600f0783e..8648b93e2 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -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)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 969be6378..de5fdf7ce 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -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)
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index 658cef0b5..24416960e 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -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)
diff --git a/java/java_test.go b/java/java_test.go
index 157dea16d..f93d69c8f 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -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)
diff --git a/sdk/testing.go b/sdk/testing.go
index 8aa9be032..e3b85195f 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -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
diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go
index fe9e82a59..bdb9915ff 100644
--- a/sysprop/sysprop_test.go
+++ b/sysprop/sysprop_test.go
@@ -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()