java_sdk_library: Add framework-modules naming scheme am: 6c9c5fc4bc

Change-Id: I0621e83f790a5aa9458e9d24d4e5bcdcfba96c49
This commit is contained in:
Paul Duffin 2020-05-13 08:32:45 +00:00 committed by Automerger Merge Worker
commit 35dd087ac2
1 changed files with 30 additions and 2 deletions

View File

@ -471,8 +471,9 @@ func (paths *scopePaths) extractStubsSourceAndApiInfoFromApiStubsProvider(dep an
type commonToSdkLibraryAndImportProperties struct {
// The naming scheme to use for the components that this module creates.
//
// If not specified then it defaults to "default", which is currently the only
// allowable value.
// If not specified then it defaults to "default". The other allowable value is
// "framework-modules" which matches the scheme currently used by framework modules
// for the equivalent components represented as separate Soong modules.
//
// This is a temporary mechanism to simplify conversion from separate modules for each
// component that follow a different naming pattern to the default one.
@ -503,6 +504,8 @@ func (c *commonToSdkLibraryAndImport) initCommonAfterDefaultsApplied(ctx android
switch schemeProperty {
case "default":
c.namingScheme = &defaultNamingScheme{}
case "framework-modules":
c.namingScheme = &frameworkModulesNamingScheme{}
default:
ctx.PropertyErrorf("naming_scheme", "expected 'default' but was %q", schemeProperty)
return false
@ -1198,6 +1201,31 @@ func (s *defaultNamingScheme) apiModuleName(scope *apiScope, baseName string) st
var _ sdkLibraryComponentNamingScheme = (*defaultNamingScheme)(nil)
type frameworkModulesNamingScheme struct {
}
func (s *frameworkModulesNamingScheme) moduleSuffix(scope *apiScope) string {
suffix := scope.name
if scope == apiScopeModuleLib {
suffix = "module_libs_"
}
return suffix
}
func (s *frameworkModulesNamingScheme) stubsLibraryModuleName(scope *apiScope, baseName string) string {
return fmt.Sprintf("%s-stubs-%sapi", baseName, s.moduleSuffix(scope))
}
func (s *frameworkModulesNamingScheme) stubsSourceModuleName(scope *apiScope, baseName string) string {
return fmt.Sprintf("%s-stubs-srcs-%sapi", baseName, s.moduleSuffix(scope))
}
func (s *frameworkModulesNamingScheme) apiModuleName(scope *apiScope, baseName string) string {
return fmt.Sprintf("%s-api-%sapi", baseName, s.moduleSuffix(scope))
}
var _ sdkLibraryComponentNamingScheme = (*frameworkModulesNamingScheme)(nil)
// java_sdk_library is a special Java library that provides optional platform APIs to apps.
// In practice, it can be viewed as a combination of several modules: 1) stubs library that clients
// are linked against to, 2) droiddoc module that internally generates API stubs source files,