Merge "Error when WITHOUT_CHECK_API=true in from-text stub build" into main am: 5373efc1c7

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

Change-Id: Ibd54f2bc9b49c8ed69658cf627693cdaf834d749
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jihoon Kang
2024-01-24 19:22:36 +00:00
committed by Automerger Merge Worker
2 changed files with 13 additions and 1 deletions

View File

@@ -182,6 +182,17 @@ func InitDroiddocModule(module android.DefaultableModule, hod android.HostOrDevi
func apiCheckEnabled(ctx android.ModuleContext, apiToCheck ApiToCheck, apiVersionTag string) bool {
if ctx.Config().IsEnvTrue("WITHOUT_CHECK_API") {
if ctx.Config().BuildFromTextStub() {
ctx.ModuleErrorf("Generating stubs from api signature files is not available " +
"with WITHOUT_CHECK_API=true, as sync between the source Java files and the " +
"api signature files is not guaranteed.\n" +
"In order to utilize WITHOUT_CHECK_API, generate stubs from the source Java " +
"files with BUILD_FROM_SOURCE_STUB=true.\n" +
"However, the usage of WITHOUT_CHECK_API is not preferred as the incremental " +
"build is slower when generating stubs from the source Java files.\n" +
"Consider updating the api signature files and generating the stubs from " +
"them instead.")
}
return false
} else if String(apiToCheck.Api_file) != "" && String(apiToCheck.Removed_api_file) != "" {
return true

View File

@@ -1194,7 +1194,8 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
`either of the two choices above and try re-building the target.\n`+
`If the mismatch between the stubs and the current.txt is intended,\n`+
`you can try re-building the target by executing the following command:\n`+
`m DISABLE_STUB_VALIDATION=true <your build target>\n`+
`m DISABLE_STUB_VALIDATION=true <your build target>.\n`+
`Note that DISABLE_STUB_VALIDATION=true does not bypass checkapi.\n`+
`******************************\n`, ctx.ModuleName())
rule.Command().