diff options
Diffstat (limited to 'java')
| -rw-r--r-- | java/java.go | 10 | ||||
| -rw-r--r-- | java/sdk_library.go | 3 | ||||
| -rw-r--r-- | java/sdk_library_internal.go | 16 |
3 files changed, 28 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go index fafe9f964..d59c6ca38 100644 --- a/java/java.go +++ b/java/java.go @@ -2310,6 +2310,16 @@ func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { var scopeOrderMap = AllApiScopes.MapToIndex( func(s *apiScope) string { return s.name }) +// Add some extra entries into scopeOrderMap for some special api surface names needed by libcore, +// external/conscrypt and external/icu and java/core-libraries. +func init() { + count := len(scopeOrderMap) + scopeOrderMap["core"] = count + 1 + scopeOrderMap["core-platform"] = count + 2 + scopeOrderMap["intra-core"] = count + 3 + scopeOrderMap["core-platform-plus-public"] = count + 4 +} + func (al *ApiLibrary) sortApiFilesByApiScope(ctx android.ModuleContext, srcFilesInfo []JavaApiImportInfo) []JavaApiImportInfo { for _, srcFileInfo := range srcFilesInfo { if srcFileInfo.ApiSurface == "" { diff --git a/java/sdk_library.go b/java/sdk_library.go index 155bea4d7..fda87f8fd 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -480,6 +480,9 @@ type ApiScopeProperties struct { // Extra libs used when compiling stubs for this scope. Libs []string + + // Name to override the api_surface that is passed down to droidstubs. + Api_surface *string } type sdkLibraryProperties struct { 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 |