summaryrefslogtreecommitdiff
path: root/api/api.go
diff options
context:
space:
mode:
author Anton Hansson <hansson@google.com> 2022-01-25 15:53:43 +0000
committer Anton Hansson <hansson@google.com> 2022-01-27 12:34:37 +0000
commitc6e9d2ffe20fd0253a6b70fe77b04fa31158b06e (patch)
treeccb92963793cd32f78e02061dd51a12a2738ed38 /api/api.go
parenta1a71aaae4d9c9cb376c7a240f13d0ce61c26791 (diff)
Generate merged public and system stubs
Eliminate another two enumerations of all modules. Bug: 169103987 Test: m android_{,system_}stubs_current && diff intermediates (no diffs) Merged-In: I0d35f1e76320356ee4e5535a40614cf7d8ff4486 Change-Id: I0d35f1e76320356ee4e5535a40614cf7d8ff4486
Diffstat (limited to 'api/api.go')
-rw-r--r--api/api.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/api/api.go b/api/api.go
index 4b6ebc1947e9..aa9e399e7272 100644
--- a/api/api.go
+++ b/api/api.go
@@ -27,6 +27,7 @@ import (
const art = "art.module.public.api"
const conscrypt = "conscrypt.module.public.api"
const i18n = "i18n.module.public.api"
+var modules_with_only_public_scope = []string{i18n, conscrypt}
// The intention behind this soong plugin is to generate a number of "merged"
// API-related modules that would otherwise require a large amount of very
@@ -183,6 +184,27 @@ func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
ctx.CreateModule(genrule.GenRuleFactory, &props)
}
+func createMergedPublicStubs(ctx android.LoadHookContext, modules []string) {
+ props := libraryProps{}
+ props.Name = proptools.StringPtr("all-modules-public-stubs")
+ props.Static_libs = transformArray(modules, "", ".stubs")
+ props.Sdk_version = proptools.StringPtr("module_current")
+ props.Visibility = []string{"//frameworks/base"}
+ ctx.CreateModule(java.LibraryFactory, &props)
+}
+
+func createMergedSystemStubs(ctx android.LoadHookContext, modules []string) {
+ props := libraryProps{}
+ modules_with_system_stubs := removeAll(modules, modules_with_only_public_scope)
+ props.Name = proptools.StringPtr("all-modules-system-stubs")
+ props.Static_libs = append(
+ transformArray(modules_with_only_public_scope, "", ".stubs"),
+ transformArray(modules_with_system_stubs, "", ".stubs.system")...)
+ props.Sdk_version = proptools.StringPtr("module_current")
+ props.Visibility = []string{"//frameworks/base"}
+ ctx.CreateModule(java.LibraryFactory, &props)
+}
+
func createMergedModuleLibStubs(ctx android.LoadHookContext, modules []string) {
// The user of this module compiles against the "core" SDK, so remove core libraries to avoid dupes.
modules = removeAll(modules, []string{art, conscrypt, i18n})
@@ -205,7 +227,7 @@ func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules []str
func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string) {
var textFiles []MergedTxtDefinition
// Two module libraries currently do not support @SystemApi so only have the public scope.
- bcpWithSystemApi := removeAll(bootclasspath, []string{conscrypt, i18n})
+ bcpWithSystemApi := removeAll(bootclasspath, modules_with_only_public_scope)
tagSuffix := []string{".api.txt}", ".removed-api.txt}"}
for i, f := range []string{"current.txt", "removed.txt"} {
@@ -253,6 +275,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
createMergedStubsSrcjar(ctx, bootclasspath)
+ createMergedPublicStubs(ctx, bootclasspath)
+ createMergedSystemStubs(ctx, bootclasspath)
createMergedModuleLibStubs(ctx, bootclasspath)
createMergedAnnotations(ctx, bootclasspath)