Merge "Apex_available check failure reveals dependency" into rvc-dev
diff --git a/apex/apex.go b/apex/apex.go
index 506a89e..ee6f93a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1982,7 +1982,7 @@
 		if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, to) {
 			return
 		}
-		ctx.ModuleErrorf("requires %q that is not available for the APEX.", to.Name())
+		ctx.ModuleErrorf("%q requires %q that is not available for the APEX.", from.Name(), to.Name())
 	})
 }
 
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 36e7ea7..6a9533e 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3011,7 +3011,7 @@
 
 func TestApexPropertiesShouldBeDefaultable(t *testing.T) {
 	// libfoo's apex_available comes from cc_defaults
-	testApexError(t, `"myapex" .*: requires "libfoo" that is not available for the APEX`, `
+	testApexError(t, `"myapex" .*: "myapex" requires "libfoo" that is not available for the APEX`, `
 	apex {
 		name: "myapex",
 		key: "myapex.key",