Default annotations_enabled to true for sdk_library

This turns out retention of Nullable annotations, which is almost
certainly what every user wants. Also add the "stub-annotations" lib to
the stub libs property, to make sure the nullability annotations
resolve properly.

Bug: 157010342
Test: m
Change-Id: I905144add4ef6f85445eedd1ba5169445f6005e0
This commit is contained in:
Anton Hansson
2020-05-21 10:38:30 +01:00
parent c5e13279ad
commit a9a3173ee3
3 changed files with 12 additions and 3 deletions

View File

@@ -789,6 +789,9 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.DefaultableHookContext
props.Patch_module = module.properties.Patch_module
props.Installable = proptools.BoolPtr(false)
props.Libs = module.sdkLibraryProperties.Stub_only_libs
// The stub-annotations library contains special versions of the annotations
// with CLASS retention policy, so that they're kept around for kotlin.
props.Libs = append(props.Libs, "stub-annotations")
props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)
props.Openjdk9.Srcs = module.properties.Openjdk9.Srcs
props.Openjdk9.Javacflags = module.properties.Openjdk9.Javacflags
@@ -822,6 +825,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
Arg_files []string
Args *string
Java_version *string
Annotations_enabled *bool
Merge_annotations_dirs []string
Merge_inclusion_annotations_dirs []string
Generate_stubs *bool
@@ -872,6 +876,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs
props.Java_version = module.properties.Java_version
props.Annotations_enabled = proptools.BoolPtr(true)
props.Merge_annotations_dirs = module.sdkLibraryProperties.Merge_annotations_dirs
props.Merge_inclusion_annotations_dirs = module.sdkLibraryProperties.Merge_inclusion_annotations_dirs