Make ShouldConvertWithBp2build avail in loadhooks

Test: Soong go tests
Change-Id: I65af040152107ce50b1a97efcee9364f28bad08b
This commit is contained in:
Liz Kammer
2023-08-11 16:15:12 -04:00
parent 4ed512b3c7
commit c86e094e13
6 changed files with 86 additions and 18 deletions

View File

@@ -353,26 +353,26 @@ func replaceDepsOnOverridingModuleMutator(ctx BottomUpMutatorContext) {
// variant of this OverridableModule, or ctx.ModuleName() if this module is not an OverridableModule
// or if this variant is not overridden.
func ModuleNameWithPossibleOverride(ctx BazelConversionContext) string {
return moduleNameWithPossibleOverride(ctx, ctx.Module())
return moduleNameWithPossibleOverride(ctx, ctx.Module(), ctx.OtherModuleName(ctx.Module()))
}
func moduleNameWithPossibleOverride(ctx bazelOtherModuleContext, module blueprint.Module) string {
func moduleNameWithPossibleOverride(ctx shouldConvertModuleContext, module blueprint.Module, name string) string {
if overridable, ok := module.(OverridableModule); ok {
if o := overridable.GetOverriddenBy(); o != "" {
return o
}
}
return ctx.OtherModuleName(module)
return name
}
// moduleDirWithPossibleOverride returns the dir of the OverrideModule that overrides the current
// variant of the given OverridableModule, or ctx.OtherModuleName() if the module is not an
// OverridableModule or if the variant is not overridden.
func moduleDirWithPossibleOverride(ctx bazelOtherModuleContext, module blueprint.Module) string {
func moduleDirWithPossibleOverride(ctx shouldConvertModuleContext, module blueprint.Module, dir string) string {
if overridable, ok := module.(OverridableModule); ok {
if o := overridable.GetOverriddenByModuleDir(); o != "" {
return o
}
}
return ctx.OtherModuleDir(module)
return dir
}