Add update-api support for Metalava am: 55e0bf4231

am: d436e87797

Change-Id: I2b56c253aae3d8b405557a208944a47e7a1c6328
This commit is contained in:
Nan Zhang
2018-08-17 16:50:57 -07:00
committed by android-build-merger

View File

@@ -1154,13 +1154,13 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
} }
if d.checkCurrentApi() && !ctx.Config().IsPdkBuild() { 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), apiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Api_file),
"check_api.current.api_file") "check_api.current.api_file")
removedApiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Removed_api_file), removedApiFile := ctx.ExpandSource(String(d.properties.Check_api.Current.Removed_api_file),
"check_api.current_removed_api_file") "check_api.current_removed_api_file")
if !Bool(d.properties.Metalava_enabled) {
d.checkCurrentApiTimestamp = android.PathForModuleOut(ctx, "check_current_api.timestamp")
d.transformCheckApi(ctx, apiFile, removedApiFile, checkApiClasspath, d.transformCheckApi(ctx, apiFile, removedApiFile, checkApiClasspath,
fmt.Sprintf(`\n******************************\n`+ fmt.Sprintf(`\n******************************\n`+
`You have tried to change the API from what has been previously approved.\n\n`+ `You have tried to change the API from what has been previously approved.\n\n`+
@@ -1173,6 +1173,12 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
` you will need approval.\n`+ ` you will need approval.\n`+
`******************************\n`, ctx.ModuleName()), String(d.properties.Check_api.Current.Args), `******************************\n`, ctx.ModuleName()), String(d.properties.Check_api.Current.Args),
d.checkCurrentApiTimestamp) 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.updateCurrentApiTimestamp = android.PathForModuleOut(ctx, "update_current_api.timestamp")
d.transformUpdateApi(ctx, apiFile, removedApiFile, d.updateCurrentApiTimestamp) d.transformUpdateApi(ctx, apiFile, removedApiFile, d.updateCurrentApiTimestamp)