summaryrefslogtreecommitdiff
path: root/java/sdk_library_internal.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2025-01-25 03:19:29 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-01-25 03:19:29 -0800
commitfe13248538eb18dc9c4522ddf5aee7e9a6ea0a8d (patch)
tree0f369ea8b52ff55970b1c8b42cedb13f5e9c8bd1 /java/sdk_library_internal.go
parentcd66fa0df90261f12bb5ece566fe018e883ee438 (diff)
parentd01f0b2c72c1a5160653e47ba68f56105212cc73 (diff)
Merge "Allow java_sdk_library to override the droidstubs api_surface per scope" into main
Diffstat (limited to 'java/sdk_library_internal.go')
-rw-r--r--java/sdk_library_internal.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/java/sdk_library_internal.go b/java/sdk_library_internal.go
index ec9c160ea..db9cd24ce 100644
--- a/java/sdk_library_internal.go
+++ b/java/sdk_library_internal.go
@@ -174,6 +174,20 @@ func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext)
mctx.CreateModule(LibraryFactory, properties...)
}
+// getApiSurfaceForScope returns the api surface name to use for the apiScope. If one is specified
+// in the corresponding ApiScopeProperties.Api_surface property that is used, otherwise the name of
+// the apiScope is used.
+func (module *SdkLibrary) getApiSurfaceForScope(apiScope *apiScope) *string {
+ scopeProperties := module.scopeToProperties[apiScope]
+
+ apiSurface := scopeProperties.Api_surface
+ if apiSurface == nil {
+ apiSurface = &apiScope.name
+ }
+
+ return apiSurface
+}
+
// Creates the [Droidstubs] module with ".stubs.source.<[apiScope.name]>" that creates stubs
// source files from the given full source files and also updates and checks the API
// specification files (i.e. "*-current.txt", "*-removed.txt" files).
@@ -227,7 +241,7 @@ func (module *SdkLibrary) createDroidstubs(mctx android.DefaultableHookContext,
props.Srcs = append(props.Srcs, module.properties.Srcs...)
props.Srcs = append(props.Srcs, module.sdkLibraryProperties.Api_srcs...)
props.Sdk_version = module.deviceProperties.Sdk_version
- props.Api_surface = &apiScope.name
+ props.Api_surface = module.getApiSurfaceForScope(apiScope)
props.System_modules = module.deviceProperties.System_modules
props.Installable = proptools.BoolPtr(false)
// A droiddoc module has only one Libs property and doesn't distinguish between