From 2178762a8aa11aee7705723b12e98c3cead8204e Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 25 Nov 2022 12:48:20 +0000 Subject: [PATCH] Remove SdkAware.SdkMemberComponentName That method was provided to allow a java_sdk_library_import that was part of a versioned sdk snapshot to create the name of its component modules consistent with the way in which modules were named within the sdk snapshot. As versioned sdk snapshots have all been removed this is no longer necessary. Bug: 260237150 Test: m nothing Change-Id: Iee35abd6d210d9a33dfd8ef2f9c77a53329fda24 --- android/sdk.go | 42 ------------------------------------------ java/sdk_library.go | 8 ++------ 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/android/sdk.go b/android/sdk.go index 5459a8aa0..b94217dfe 100644 --- a/android/sdk.go +++ b/android/sdk.go @@ -25,36 +25,6 @@ import ( // sdkAwareWithoutModule is provided simply to improve code navigation with the IDE. 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 "@" 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 MakeMemberOf(sdk SdkRef) IsInAnySdk() bool @@ -168,18 +138,6 @@ func (s *SdkBase) sdkBase() *SdkBase { 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 func (s *SdkBase) MakeMemberOf(sdk SdkRef) { s.properties.ContainingSdk = &sdk diff --git a/java/sdk_library.go b/java/sdk_library.go index 56e555078..012309d4a 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -831,18 +831,14 @@ func (c *commonToSdkLibraryAndImport) xmlPermissionsModuleName() string { // Name of the java_library module that compiles the stubs source. func (c *commonToSdkLibraryAndImport) stubsLibraryModuleName(apiScope *apiScope) string { baseName := c.module.BaseModuleName() - return c.module.SdkMemberComponentName(baseName, func(name string) string { - return c.namingScheme.stubsLibraryModuleName(apiScope, name) - }) + return c.namingScheme.stubsLibraryModuleName(apiScope, baseName) } // Name of the droidstubs module that generates the stubs source and may also // generate/check the API. func (c *commonToSdkLibraryAndImport) stubsSourceModuleName(apiScope *apiScope) string { baseName := c.module.BaseModuleName() - return c.module.SdkMemberComponentName(baseName, func(name string) string { - return c.namingScheme.stubsSourceModuleName(apiScope, name) - }) + return c.namingScheme.stubsSourceModuleName(apiScope, baseName) } // The component names for different outputs of the java_sdk_library.