Improve missing apex_available message
The apex available check can traverse quite a long path (5+ steps) to
get from the apex to a module that is missing the apex from its
apex_available property. Understanding where that dependency came from
can often require examining the dependency path which can be difficult.
This change adds the path to the error to simplify that process.
Bug: 153306490
Test: m nothing
Bug: 152762638
Merged-In: Ic4eb169dc2026cd8339d49e23b25d6d1c3879750
Change-Id: Ic4eb169dc2026cd8339d49e23b25d6d1c3879750
diff --git a/apex/apex.go b/apex/apex.go
index bfb77a8..02aca44 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1772,7 +1772,7 @@
// Visit dependencies that contributes to the payload of this APEX
func (a *apexBundle) walkPayloadDeps(ctx android.ModuleContext,
do func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool)) {
- ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
+ ctx.WalkDeps(func(child, parent android.Module) bool {
am, ok := child.(android.ApexModule)
if !ok || !am.CanHaveApexVariants() {
return false
@@ -1830,7 +1830,11 @@
if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, toName) {
return
}
- ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", fromName, toName)
+ message := ""
+ for _, m := range ctx.GetWalkPath()[1:] {
+ message = fmt.Sprintf("%s\n -> %s", message, m.String())
+ }
+ ctx.ModuleErrorf("%q requires %q that is not available for the APEX. Dependency path:%s", fromName, toName, message)
})
}