diff options
author | Nan Zhang <nanzhang@google.com> | 2018-08-16 16:23:11 -0700 |
---|---|---|
committer | Nan Zhang <nanzhang@google.com> | 2018-08-17 12:38:15 -0700 |
commit | 55e0bf42317822cf995ae973c172cc1d4db3090a (patch) | |
tree | 4458ec45bdd238d9636ce169329bbe57483dfd39 /java | |
parent | 863f05b797467bf209c305366fd8a2e84134ce24 (diff) | |
download | android_build_soong-55e0bf42317822cf995ae973c172cc1d4db3090a.tar.gz android_build_soong-55e0bf42317822cf995ae973c172cc1d4db3090a.tar.bz2 android_build_soong-55e0bf42317822cf995ae973c172cc1d4db3090a.zip |
Add update-api support for Metalava
Test: m -j api-stubs-docs-update-current-api
Bug: b/112668343
Change-Id: Ia91ae6969b01c21d88de7ceef4b25a73d0efd4a1
Diffstat (limited to 'java')
-rw-r--r-- | java/droiddoc.go | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/java/droiddoc.go b/java/droiddoc.go index 19459298..f90c548f 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -1154,25 +1154,31 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) { } if d.checkCurrentApi() && !ctx.Config().IsPdkBuild() { - d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp") - apiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Api_file), "check_api.current.api_file") removedApiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Removed_api_file), "check_api.current_removed_api_file") - d.transformCheckApi(ctx, apiFile, removedApiFile, checkApiClasspath, - fmt.Sprintf(`\n******************************\n`+ - `You have tried to change the API from what has been previously approved.\n\n`+ - `To make these errors go away, you have two choices:\n`+ - ` 1. You can add '@hide' javadoc comments to the methods, etc. listed in the\n`+ - ` errors above.\n\n`+ - ` 2. You can update current.txt by executing the following command:\n`+ - ` make %s-update-current-api\n\n`+ - ` To submit the revised current.txt to the main Android repository,\n`+ - ` you will need approval.\n`+ - `******************************\n`, ctx.ModuleName()), String(d.properties.Check_api.Current.Args), - d.checkCurrentApiTimestamp) + if !Bool(d.properties.Metalava_enabled) { + d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp") + d.transformCheckApi(ctx, apiFile, removedApiFile, checkApiClasspath, + fmt.Sprintf(`\n******************************\n`+ + `You have tried to change the API from what has been previously approved.\n\n`+ + `To make these errors go away, you have two choices:\n`+ + ` 1. You can add '@hide' javadoc comments to the methods, etc. listed in the\n`+ + ` errors above.\n\n`+ + ` 2. You can update current.txt by executing the following command:\n`+ + ` make %s-update-current-api\n\n`+ + ` To submit the revised current.txt to the main Android repository,\n`+ + ` you will need approval.\n`+ + `******************************\n`, ctx.ModuleName()), String(d.properties.Check_api.Current.Args), + d.checkCurrentApiTimestamp) + } else { + // TODO(nanzhang): Refactor below when Metalava support API check. + if d.apiFile == nil || d.removedApiFile == nil { + ctx.ModuleErrorf("api_filename and removed_api_filename properties cannot be empty for API check!") + } + } d.updateCurrentApiTimestamp = android.PathForModuleOut(ctx, "update_current_api.timestamp") d.transformUpdateApi(ctx, apiFile, removedApiFile, d.updateCurrentApiTimestamp) |