Merge "Remove SdkAware.SdkMemberComponentName" am: 3c867b6ce8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2318637 Change-Id: Ied96346e321fbbbfd741ad7fbf67ae6b542976af Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -25,36 +25,6 @@ import (
|
|||||||
|
|
||||||
// sdkAwareWithoutModule is provided simply to improve code navigation with the IDE.
|
// sdkAwareWithoutModule is provided simply to improve code navigation with the IDE.
|
||||||
type sdkAwareWithoutModule interface {
|
type sdkAwareWithoutModule interface {
|
||||||
// SdkMemberComponentName will return the name to use for a component of this module based on the
|
|
||||||
// base name of this module.
|
|
||||||
//
|
|
||||||
// The baseName is the name returned by ModuleBase.BaseModuleName(), i.e. the name specified in
|
|
||||||
// the name property in the .bp file so will not include the prebuilt_ prefix.
|
|
||||||
//
|
|
||||||
// The componentNameCreator is a func for creating the name of a component from the base name of
|
|
||||||
// the module, e.g. it could just append ".component" to the name passed in.
|
|
||||||
//
|
|
||||||
// This is intended to be called by prebuilt modules that create component models. It is because
|
|
||||||
// prebuilt module base names come in a variety of different forms:
|
|
||||||
// * unversioned - this is the same as the source module.
|
|
||||||
// * internal to an sdk - this is the unversioned name prefixed by the base name of the sdk
|
|
||||||
// module.
|
|
||||||
// * versioned - this is the same as the internal with the addition of an "@<version>" suffix.
|
|
||||||
//
|
|
||||||
// While this can be called from a source module in that case it will behave the same way as the
|
|
||||||
// unversioned name and return the result of calling the componentNameCreator func on the supplied
|
|
||||||
// base name.
|
|
||||||
//
|
|
||||||
// e.g. Assuming the componentNameCreator func simply appends ".component" to the name passed in
|
|
||||||
// then this will work as follows:
|
|
||||||
// * An unversioned name of "foo" will return "foo.component".
|
|
||||||
// * An internal to the sdk name of "sdk_foo" will return "sdk_foo.component".
|
|
||||||
// * A versioned name of "sdk_foo@current" will return "sdk_foo.component@current".
|
|
||||||
//
|
|
||||||
// Note that in the latter case the ".component" suffix is added before the version. Adding it
|
|
||||||
// after would change the version.
|
|
||||||
SdkMemberComponentName(baseName string, componentNameCreator func(string) string) string
|
|
||||||
|
|
||||||
sdkBase() *SdkBase
|
sdkBase() *SdkBase
|
||||||
MakeMemberOf(sdk SdkRef)
|
MakeMemberOf(sdk SdkRef)
|
||||||
IsInAnySdk() bool
|
IsInAnySdk() bool
|
||||||
@@ -168,18 +138,6 @@ func (s *SdkBase) sdkBase() *SdkBase {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SdkBase) SdkMemberComponentName(baseName string, componentNameCreator func(string) string) string {
|
|
||||||
if s.MemberName() == "" {
|
|
||||||
return componentNameCreator(baseName)
|
|
||||||
} else {
|
|
||||||
index := strings.LastIndex(baseName, "@")
|
|
||||||
unversionedName := baseName[:index]
|
|
||||||
unversionedComponentName := componentNameCreator(unversionedName)
|
|
||||||
versionSuffix := baseName[index:]
|
|
||||||
return unversionedComponentName + versionSuffix
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MakeMemberOf sets this module to be a member of a specific SDK
|
// MakeMemberOf sets this module to be a member of a specific SDK
|
||||||
func (s *SdkBase) MakeMemberOf(sdk SdkRef) {
|
func (s *SdkBase) MakeMemberOf(sdk SdkRef) {
|
||||||
s.properties.ContainingSdk = &sdk
|
s.properties.ContainingSdk = &sdk
|
||||||
|
@@ -831,18 +831,14 @@ func (c *commonToSdkLibraryAndImport) xmlPermissionsModuleName() string {
|
|||||||
// Name of the java_library module that compiles the stubs source.
|
// Name of the java_library module that compiles the stubs source.
|
||||||
func (c *commonToSdkLibraryAndImport) stubsLibraryModuleName(apiScope *apiScope) string {
|
func (c *commonToSdkLibraryAndImport) stubsLibraryModuleName(apiScope *apiScope) string {
|
||||||
baseName := c.module.BaseModuleName()
|
baseName := c.module.BaseModuleName()
|
||||||
return c.module.SdkMemberComponentName(baseName, func(name string) string {
|
return c.namingScheme.stubsLibraryModuleName(apiScope, baseName)
|
||||||
return c.namingScheme.stubsLibraryModuleName(apiScope, name)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name of the droidstubs module that generates the stubs source and may also
|
// Name of the droidstubs module that generates the stubs source and may also
|
||||||
// generate/check the API.
|
// generate/check the API.
|
||||||
func (c *commonToSdkLibraryAndImport) stubsSourceModuleName(apiScope *apiScope) string {
|
func (c *commonToSdkLibraryAndImport) stubsSourceModuleName(apiScope *apiScope) string {
|
||||||
baseName := c.module.BaseModuleName()
|
baseName := c.module.BaseModuleName()
|
||||||
return c.module.SdkMemberComponentName(baseName, func(name string) string {
|
return c.namingScheme.stubsSourceModuleName(apiScope, baseName)
|
||||||
return c.namingScheme.stubsSourceModuleName(apiScope, name)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The component names for different outputs of the java_sdk_library.
|
// The component names for different outputs of the java_sdk_library.
|
||||||
|
Reference in New Issue
Block a user