summaryrefslogtreecommitdiff
path: root/api/api.go
diff options
context:
space:
mode:
author Anton Hansson <hansson@google.com> 2022-01-12 14:45:22 +0000
committer Anton Hansson <hansson@google.com> 2022-01-17 19:07:05 +0000
commitcc18e03e440124cc084f72ce7217b631d034333b (patch)
tree5d8211fd91dbf091d45a2ec857818055a619f0b6 /api/api.go
parentec450c058e4a2e3d8085f528b627759d5084d76f (diff)
Construct sdk-annotations.zip programmatically
Avoid hardcoding the list of modules in yet another place. Bug: 169103987 Test: diff zip before & after (identical) Merged-In: Id3983bf5f4b96b23b1da09fd3617870ac3926ea1 Change-Id: Id3983bf5f4b96b23b1da09fd3617870ac3926ea1
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/api/api.go b/api/api.go
index 74cbece7ebf5..a61d5c2c3497 100644
--- a/api/api.go
+++ b/api/api.go
@@ -123,6 +123,19 @@ func createMergedStubsSrcjar(ctx android.LoadHookContext, modules []string) {
ctx.CreateModule(genrule.GenRuleFactory, &props)
}
+// This produces the same annotations.zip as framework-doc-stubs, but by using
+// outputs from individual modules instead of all the source code.
+func createMergedAnnotations(ctx android.LoadHookContext, modules []string) {
+ props := genruleProps{}
+ props.Name = proptools.StringPtr("sdk-annotations.zip")
+ props.Tools = []string{"merge_annotation_zips", "soong_zip"}
+ props.Out = []string{"annotations.zip"}
+ props.Cmd = proptools.StringPtr("$(location merge_annotation_zips) $(genDir)/out $(in) && " +
+ "$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out")
+ props.Srcs = createSrcs(":android-non-updatable-doc-stubs{.annotations.zip}", modules, "{.public.annotations.zip}")
+ ctx.CreateModule(genrule.GenRuleFactory, &props)
+}
+
func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
props := genruleProps{}
props.Name = proptools.StringPtr("api-versions-xml-public-filtered")
@@ -204,6 +217,12 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
createMergedStubsSrcjar(ctx, a.properties.Bootclasspath)
+ // Conscrypt and i18n currently do not enable annotations
+ annotationModules := a.properties.Bootclasspath
+ annotationModules = remove(annotationModules, "conscrypt.module.public.api")
+ annotationModules = remove(annotationModules, "i18n.module.public.api")
+ createMergedAnnotations(ctx, annotationModules)
+
// For the filtered api versions, we prune all APIs except art module's APIs. because
// 1) ART apis are available by default to all modules, while other module-to-module deps are
// explicit and probably receive more scrutiny anyway