Merge "Set previous_api correctly for java_sdk_library"

This commit is contained in:
Anton Hansson
2020-12-31 08:53:18 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 0 deletions

View File

@@ -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

View File

@@ -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))