From 9a419e28f523d8daadda15841089b22f31166a44 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 16 Aug 2024 17:14:21 +0900 Subject: apex: apex_available with prefix We now support prefix form (com.foo.*) in apex_available list. Bug: 360265761 Test: m --no-skip-soong-tests Change-Id: I50ab884651dd6321950cfd4563b59ef3ed0f07fd --- apex/apex.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'apex/apex.go') diff --git a/apex/apex.go b/apex/apex.go index dd1c0b52e..77ebf2624 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2767,10 +2767,21 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { if to.AvailableFor(apexName) || baselineApexAvailable(apexName, toName) { return true } + + // Let's give some hint for apex_available + hint := fmt.Sprintf("%q", apexName) + + if strings.HasPrefix(apexName, "com.") && !strings.HasPrefix(apexName, "com.android.") && strings.Count(apexName, ".") >= 2 { + // In case of a partner APEX, prefix format might be an option. + components := strings.Split(apexName, ".") + components[len(components)-1] = "*" + hint += fmt.Sprintf(" or %q", strings.Join(components, ".")) + } + ctx.ModuleErrorf("%q requires %q that doesn't list the APEX under 'apex_available'."+ "\n\nDependency path:%s\n\n"+ - "Consider adding %q to 'apex_available' property of %q", - fromName, toName, ctx.GetPathString(true), apexName, toName) + "Consider adding %s to 'apex_available' property of %q", + fromName, toName, ctx.GetPathString(true), hint, toName) // Visit this module's dependencies to check and report any issues with their availability. return true }) -- cgit v1.2.3-59-g8ed1b