diff --git a/java/droiddoc.go b/java/droiddoc.go index cbca12a76..f54b51711 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -1082,6 +1082,10 @@ func (d *Droidstubs) DepsMutator(ctx android.BottomUpMutatorContext) { // If requested clear any properties that provide information about the latest version // of an API and which reference non-existent modules. if Bool(d.properties.Check_api.Ignore_missing_latest_api) { + previousApi := android.SrcIsModule(String(d.properties.Previous_api)) + if previousApi != "" && !ctx.OtherModuleExists(previousApi) { + d.properties.Previous_api = nil + } ignoreMissingModules(ctx, &d.properties.Check_api.Last_released) // If the new_since references a module, e.g. :module-latest-api and the module diff --git a/java/sdk_library.go b/java/sdk_library.go index f279b95b6..057e14bac 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -1271,6 +1271,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC Merge_annotations_dirs []string Merge_inclusion_annotations_dirs []string Generate_stubs *bool + Previous_api *string Check_api struct { Current ApiToCheck Last_released ApiToCheck @@ -1363,6 +1364,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC if !apiScope.unstable { // check against the latest released API latestApiFilegroupName := proptools.StringPtr(module.latestApiFilegroupName(apiScope)) + props.Previous_api = latestApiFilegroupName props.Check_api.Last_released.Api_file = latestApiFilegroupName props.Check_api.Last_released.Removed_api_file = proptools.StringPtr( module.latestRemovedApiFilegroupName(apiScope))