Merge "Friendly error message on apex_available and min_sdk_version checks"
This commit is contained in:
commit
4a349ab66b
|
@ -849,8 +849,12 @@ func CheckMinSdkVersion(m UpdatableModule, ctx ModuleContext, minSdkVersion ApiL
|
||||||
if err := to.ShouldSupportSdkVersion(ctx, minSdkVersion); err != nil {
|
if err := to.ShouldSupportSdkVersion(ctx, minSdkVersion); err != nil {
|
||||||
toName := ctx.OtherModuleName(to)
|
toName := ctx.OtherModuleName(to)
|
||||||
if ver, ok := minSdkVersionAllowlist[toName]; !ok || ver.GreaterThan(minSdkVersion) {
|
if ver, ok := minSdkVersionAllowlist[toName]; !ok || ver.GreaterThan(minSdkVersion) {
|
||||||
ctx.OtherModuleErrorf(to, "should support min_sdk_version(%v) for %q: %v. Dependency path: %s",
|
ctx.OtherModuleErrorf(to, "should support min_sdk_version(%v) for %q: %v."+
|
||||||
minSdkVersion, ctx.ModuleName(), err.Error(), ctx.GetPathString(false))
|
"\n\nDependency path: %s\n\n"+
|
||||||
|
"Consider adding 'min_sdk_version: %q' to %q",
|
||||||
|
minSdkVersion, ctx.ModuleName(), err.Error(),
|
||||||
|
ctx.GetPathString(false),
|
||||||
|
minSdkVersion, ctx.ModuleName())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2244,8 +2244,10 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
|
||||||
if to.AvailableFor(apexName) || baselineApexAvailable(apexName, toName) {
|
if to.AvailableFor(apexName) || baselineApexAvailable(apexName, toName) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
ctx.ModuleErrorf("%q requires %q that doesn't list the APEX under 'apex_available'. Dependency path:%s",
|
ctx.ModuleErrorf("%q requires %q that doesn't list the APEX under 'apex_available'."+
|
||||||
fromName, toName, ctx.GetPathString(true))
|
"\n\nDependency path:%s\n\n"+
|
||||||
|
"Consider adding %q to 'apex_available' property of %q",
|
||||||
|
fromName, toName, ctx.GetPathString(true), apexName, toName)
|
||||||
// Visit this module's dependencies to check and report any issues with their availability.
|
// Visit this module's dependencies to check and report any issues with their availability.
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
|
@ -5315,7 +5315,7 @@ func TestApexAvailable_DirectDep(t *testing.T) {
|
||||||
|
|
||||||
func TestApexAvailable_IndirectDep(t *testing.T) {
|
func TestApexAvailable_IndirectDep(t *testing.T) {
|
||||||
// libbbaz is an indirect dep
|
// libbbaz is an indirect dep
|
||||||
testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'. Dependency path:
|
testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'.\n\nDependency path:
|
||||||
.*via tag apex\.dependencyTag.*name:sharedLib.*
|
.*via tag apex\.dependencyTag.*name:sharedLib.*
|
||||||
.*-> libfoo.*link:shared.*
|
.*-> libfoo.*link:shared.*
|
||||||
.*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.*
|
.*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.*
|
||||||
|
|
Loading…
Reference in New Issue