Fix java prebuilts
The java prebuilt tests weren't registering the prebuilts mutators,
which hid an issue where prebuilts modules weren't getting renamed
to avoid collisions with source modules of the same name, which
ended up causing the prebuilt module to try to add a dependency
on itself.
Test: java_test.go
Change-Id: I3327d27533591cb08a4b8b8b5e1668a6f72be8df
diff --git a/android/mutator.go b/android/mutator.go
index c8f3e8f..e20bc2c 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -74,7 +74,7 @@
func(ctx RegisterMutatorsContext) {
ctx.TopDown("load_hooks", loadHookMutator).Parallel()
},
- registerPrebuiltsPreArchMutators,
+ RegisterPrebuiltsPreArchMutators,
RegisterDefaultsPreArchMutators,
}
@@ -86,7 +86,7 @@
}
var postDeps = []RegisterMutatorFunc{
- registerPrebuiltsPostDepsMutators,
+ RegisterPrebuiltsPostDepsMutators,
}
func PreArchMutators(f RegisterMutatorFunc) {
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 080df91..507aa5f 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -61,11 +61,11 @@
Prebuilt() *Prebuilt
}
-func registerPrebuiltsPreArchMutators(ctx RegisterMutatorsContext) {
+func RegisterPrebuiltsPreArchMutators(ctx RegisterMutatorsContext) {
ctx.BottomUp("prebuilts", prebuiltMutator).Parallel()
}
-func registerPrebuiltsPostDepsMutators(ctx RegisterMutatorsContext) {
+func RegisterPrebuiltsPostDepsMutators(ctx RegisterMutatorsContext) {
ctx.TopDown("prebuilt_select", PrebuiltSelectModuleMutator).Parallel()
ctx.BottomUp("prebuilt_replace", PrebuiltReplaceMutator).Parallel()
}
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index fe763ed..774a15c 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -123,8 +123,8 @@
for _, test := range prebuiltsTests {
t.Run(test.name, func(t *testing.T) {
ctx := NewTestContext()
- ctx.PreArchMutators(registerPrebuiltsPreArchMutators)
- ctx.PostDepsMutators(registerPrebuiltsPostDepsMutators)
+ ctx.PreArchMutators(RegisterPrebuiltsPreArchMutators)
+ ctx.PostDepsMutators(RegisterPrebuiltsPostDepsMutators)
ctx.RegisterModuleType("prebuilt", ModuleFactoryAdaptor(newPrebuiltModule))
ctx.RegisterModuleType("source", ModuleFactoryAdaptor(newSourceModule))
ctx.Register()