From b73c3a6d221523f06d30c15145866056556187d0 Mon Sep 17 00:00:00 2001 From: Yu Liu Date: Tue, 10 Dec 2024 00:58:06 +0000 Subject: Convert checkApexAvailability to use ModuleProxy. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I7582db8e22e94d0a9db7715a76bb6ed34c166a4e --- apex/apex.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'apex/apex.go') diff --git a/apex/apex.go b/apex/apex.go index e22cf9ea6..912780dca 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2694,7 +2694,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { return } - a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from android.Module, to android.ApexModule, externalDep bool) bool { + a.WalkPayloadDepsProxy(ctx, func(ctx android.BaseModuleContext, from, to android.ModuleProxy, externalDep bool) bool { // As soon as the dependency graph crosses the APEX boundary, don't go further. if externalDep { return false @@ -2711,17 +2711,8 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { fromName := ctx.OtherModuleName(from) toName := ctx.OtherModuleName(to) - // If `to` is not actually in the same APEX as `from` then it does not need - // apex_available and neither do any of its dependencies. - // - // It is ok to call DepIsInSameApex() directly from within WalkPayloadDeps(). - if am, ok := from.(android.DepIsInSameApex); ok && !am.DepIsInSameApex(ctx, to) { - // As soon as the dependency graph crosses the APEX boundary, don't go - // further. - return false - } - - if to.AvailableFor(apexName) { + if android.CheckAvailableForApex(apexName, + android.OtherModuleProviderOrDefault(ctx, to, android.ApexInfoProvider).ApexAvailableFor) { return true } -- cgit v1.2.3-59-g8ed1b