diff options
author | 2021-02-12 11:46:42 +0000 | |
---|---|---|
committer | 2021-02-16 13:28:26 +0000 | |
commit | 031d8693b3dae7edaca2e5fef3d017ac2e67424d (patch) | |
tree | 496cc3cd5c3166c0b4c048fe7e66e5833e46a93a /java/hiddenapi.go | |
parent | 7ad17bdad5b613d483d4f77d3c7637c407904211 (diff) |
Allow explicitly specified additional annotations for hiddenapi
Adds the hiddenapi_additional_annotations to allow a library to list
the libraries that provided additional hiddenapi related annotations
for a library.
Modifies merge_csv.py so it can process multiple zip files at the same
time and uses that to merge the embedded .uau files from a module and
those it depends upon.
Bug: 180102243
Test: m droid
Verified that hiddenapi files (both aggregated ones and for the
individual modules) are not affected by this change.
Change-Id: I796520021c7357398a9e2a09f1029e4a578b05b3
Diffstat (limited to 'java/hiddenapi.go')
-rw-r--r-- | java/hiddenapi.go | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/java/hiddenapi.go b/java/hiddenapi.go index 1651c1c6d..f8e41c458 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -221,13 +221,19 @@ func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJa return } + classesJars := android.Paths{classesJar} + ctx.VisitDirectDepsWithTag(hiddenApiAnnotationsTag, func(dep android.Module) { + javaInfo := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo) + classesJars = append(classesJars, javaInfo.ImplementationJars...) + }) + stubFlagsCSV := hiddenAPISingletonPaths(ctx).stubFlags flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv") ctx.Build(pctx, android.BuildParams{ Rule: hiddenAPIGenerateCSVRule, Description: "hiddenapi flags", - Input: classesJar, + Inputs: classesJars, Output: flagsCSV, Implicit: stubFlagsCSV, Args: map[string]string{ @@ -241,7 +247,7 @@ func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJa ctx.Build(pctx, android.BuildParams{ Rule: hiddenAPIGenerateCSVRule, Description: "hiddenapi metadata", - Input: classesJar, + Inputs: classesJars, Output: metadataCSV, Implicit: stubFlagsCSV, Args: map[string]string{ @@ -255,8 +261,9 @@ func (h *hiddenAPI) hiddenAPIExtractInformation(ctx android.ModuleContext, dexJa rule := android.NewRuleBuilder(pctx, ctx) rule.Command(). BuiltTool("merge_csv"). - FlagWithInput("--zip_input=", classesJar). - FlagWithOutput("--output=", indexCSV) + Flag("--zip_input"). + FlagWithOutput("--output=", indexCSV). + Inputs(classesJars) rule.Build("merged-hiddenapi-index", "Merged Hidden API index") h.indexCSVPath = indexCSV @@ -335,3 +342,16 @@ func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, TransformZipAlign(ctx, output, tmpOutput) } } + +type hiddenApiAnnotationsDependencyTag struct { + blueprint.BaseDependencyTag +} + +// Tag used to mark dependencies on java_library instances that contains Java source files whose +// sole purpose is to provide additional hiddenapi annotations. +var hiddenApiAnnotationsTag hiddenApiAnnotationsDependencyTag + +// Mark this tag so dependencies that use it are excluded from APEX contents. +func (t hiddenApiAnnotationsDependencyTag) ExcludeFromApexContents() {} + +var _ android.ExcludeFromApexContentsTag = hiddenApiAnnotationsTag |