java_sdk_library: Add support for module_lib API surface

Adds api scope for the module_lib and adds that to the list of all
all available scopes. The scope is generated if and only if the
api_surfaces property contains "module_lib".

No other changes are needed as the generation of the APIs is completely
driven by the allApiScopes array and the information in its contained
apiScope structures.

Test: m checkapi
Bug: 155164730
Change-Id: I7769af6823badca8715a270f86cf53b4e954b7df
This commit is contained in:
Paul Duffin
2020-04-28 14:13:56 +01:00
parent 3375e35d99
commit 8f265b9ab9
2 changed files with 137 additions and 0 deletions

View File

@@ -186,10 +186,30 @@ var (
droidstubsArgs: []string{"-showAnnotation android.annotation.TestApi"},
unstable: true,
})
apiScopeModuleLib = initApiScope(&apiScope{
name: "module_lib",
extends: apiScopeSystem,
// Module_lib scope is disabled by default in legacy mode.
//
// Enabling this would break existing usages.
legacyEnabledStatus: func(module *SdkLibrary) bool {
return false
},
scopeSpecificProperties: func(module *SdkLibrary) *ApiScopeProperties {
return &module.sdkLibraryProperties.Module_lib
},
apiFilePrefix: "module-lib-",
moduleSuffix: ".module_lib",
sdkVersion: "module_current",
droidstubsArgs: []string{
"--show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)",
},
})
allApiScopes = apiScopes{
apiScopePublic,
apiScopeSystem,
apiScopeTest,
apiScopeModuleLib,
}
)
@@ -303,6 +323,12 @@ type sdkLibraryProperties struct {
// In non-legacy mode the test api scope is disabled by default.
Test ApiScopeProperties
// The properties specific to the module_lib api scope
//
// Unless explicitly specified by using test.enabled the module_lib api scope is
// disabled by default.
Module_lib ApiScopeProperties
// TODO: determines whether to create HTML doc or not
//Html_doc *bool
}