summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2020-05-20 19:35:27 +0100
committer Anton Hansson <hansson@google.com> 2020-05-27 17:52:53 +0100
commit2ce1e81b3e67a069afa80a2dd15d4ac6b3ce3655 (patch)
treecca671dd50cf31ea1ed852ac16ec59a4d34dc97d
parent0bd88d0b4e782df6aa99475307a4cfab6d617d14 (diff)
java_sdk_library: Add annotations_enabled property
Passes it through to droidstubs. Bug: 155164730 Test: m droid Change-Id: I8b23a959ce33716dfc4572488a1fd3f6bab73a17
-rw-r--r--java/sdk_library.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 94f38f558..7a24a0160 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -379,6 +379,9 @@ type sdkLibraryProperties struct {
// $(location <label>): the path to the droiddoc_option_files with name <label>
Droiddoc_options []string
+ // is set to true, Metalava will allow framework SDK to contain annotations.
+ Annotations_enabled *bool
+
// a list of top-level directories containing files to merge qualifier annotations
// (i.e. those intended to be included in the stubs written) from.
Merge_annotations_dirs []string
@@ -789,6 +792,11 @@ 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.
+ if proptools.Bool(module.sdkLibraryProperties.Annotations_enabled) {
+ 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 +830,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 +881,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 = module.sdkLibraryProperties.Annotations_enabled
props.Merge_annotations_dirs = module.sdkLibraryProperties.Merge_annotations_dirs
props.Merge_inclusion_annotations_dirs = module.sdkLibraryProperties.Merge_inclusion_annotations_dirs