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
This commit is contained in:
parent
ed2c78ef4e
commit
5ea9bcc50b
|
@ -74,7 +74,7 @@ var preArch = []RegisterMutatorFunc{
|
|||
func(ctx RegisterMutatorsContext) {
|
||||
ctx.TopDown("load_hooks", loadHookMutator).Parallel()
|
||||
},
|
||||
registerPrebuiltsPreArchMutators,
|
||||
RegisterPrebuiltsPreArchMutators,
|
||||
RegisterDefaultsPreArchMutators,
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ var preDeps = []RegisterMutatorFunc{
|
|||
}
|
||||
|
||||
var postDeps = []RegisterMutatorFunc{
|
||||
registerPrebuiltsPostDepsMutators,
|
||||
RegisterPrebuiltsPostDepsMutators,
|
||||
}
|
||||
|
||||
func PreArchMutators(f RegisterMutatorFunc) {
|
||||
|
|
|
@ -61,11 +61,11 @@ type PrebuiltInterface interface {
|
|||
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()
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ func TestPrebuilts(t *testing.T) {
|
|||
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()
|
||||
|
|
|
@ -531,6 +531,10 @@ func (j *Prebuilt) Prebuilt() *android.Prebuilt {
|
|||
return &j.prebuilt
|
||||
}
|
||||
|
||||
func (j *Prebuilt) Name() string {
|
||||
return j.prebuilt.Name(j.ModuleBase.Name())
|
||||
}
|
||||
|
||||
func (j *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ func testJava(t *testing.T, bp string) *android.TestContext {
|
|||
ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
||||
ctx.RegisterModuleType("java_prebuilt_library", android.ModuleFactoryAdaptor(PrebuiltFactory))
|
||||
ctx.RegisterModuleType("java_defaults", android.ModuleFactoryAdaptor(defaultsFactory))
|
||||
ctx.PreArchMutators(android.RegisterPrebuiltsPreArchMutators)
|
||||
ctx.PreArchMutators(android.RegisterPrebuiltsPostDepsMutators)
|
||||
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
||||
ctx.Register()
|
||||
|
||||
|
|
Loading…
Reference in New Issue