Merge "Update platform_apis error message" am: a7f0c39214

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1893228

Change-Id: I7d8d4b5fc89657bc544206b0f3be868604b49456
This commit is contained in:
Treehugger Robot 2021-11-17 01:45:55 +00:00 committed by Automerger Merge Worker
commit 2cfe9c9686
2 changed files with 4 additions and 4 deletions

View file

@ -144,14 +144,14 @@ func TestPlatformAPIs(t *testing.T) {
}
`)
testJavaError(t, "platform_apis must be true when sdk_version is empty.", `
testJavaError(t, "This module has conflicting settings. sdk_version is empty, which means that this module is build against platform APIs. However platform_apis is not set to true", `
android_app {
name: "bar",
srcs: ["b.java"],
}
`)
testJavaError(t, "platform_apis must be false when sdk_version is not empty.", `
testJavaError(t, "This module has conflicting settings. sdk_version is not empty, which means this module cannot use platform APIs. However platform_apis is set to true.", `
android_app {
name: "bar",
srcs: ["b.java"],

View file

@ -510,9 +510,9 @@ func (j *Module) checkPlatformAPI(ctx android.ModuleContext) {
usePlatformAPI := proptools.Bool(j.deviceProperties.Platform_apis)
sdkVersionSpecified := sc.SdkVersion(ctx).Specified()
if usePlatformAPI && sdkVersionSpecified {
ctx.PropertyErrorf("platform_apis", "platform_apis must be false when sdk_version is not empty.")
ctx.PropertyErrorf("platform_apis", "This module has conflicting settings. sdk_version is not empty, which means this module cannot use platform APIs. However platform_apis is set to true.")
} else if !usePlatformAPI && !sdkVersionSpecified {
ctx.PropertyErrorf("platform_apis", "platform_apis must be true when sdk_version is empty.")
ctx.PropertyErrorf("platform_apis", "This module has conflicting settings. sdk_version is empty, which means that this module is build against platform APIs. However platform_apis is not set to true")
}
}