Remove unused property naming_scheme in java_sdk_library

The property was introduced as an interim solution, and is currently
unused.

Test: m nothing --no-skip-soong-tests
Bug: 366071058
Change-Id: I57abdb64fabdb34fbbd1190851bc528dbb88c7f8
This commit is contained in:
Jihoon Kang
2024-09-12 00:01:54 +00:00
parent 8ca2a80d27
commit 2261a82dbd
4 changed files with 9 additions and 130 deletions

View File

@@ -2674,7 +2674,7 @@ func TestDisableFromTextStubForCoverageBuild(t *testing.T) {
android.AssertBoolEquals(t, "stub module expected to depend on from-source stub",
true, CheckModuleHasDependency(t, result.TestContext,
apiScopePublic.stubsLibraryModuleName("foo"), "android_common",
apiScopePublic.sourceStubLibraryModuleName("foo")))
apiScopePublic.sourceStubsLibraryModuleName("foo")))
android.AssertBoolEquals(t, "stub module expected to not depend on from-text stub",
false, CheckModuleHasDependency(t, result.TestContext,

View File

@@ -248,7 +248,7 @@ func (scope *apiScope) apiLibraryModuleName(baseName string) string {
return scope.stubsLibraryModuleName(baseName) + ".from-text"
}
func (scope *apiScope) sourceStubLibraryModuleName(baseName string) string {
func (scope *apiScope) sourceStubsLibraryModuleName(baseName string) string {
return scope.stubsLibraryModuleName(baseName) + ".from-source"
}
@@ -830,16 +830,6 @@ func (paths *scopePaths) extractLatestRemovedApiPath(ctx android.ModuleContext,
}
type commonToSdkLibraryAndImportProperties struct {
// The naming scheme to use for the components that this module creates.
//
// If not specified then it defaults to "default".
//
// This is a temporary mechanism to simplify conversion from separate modules for each
// component that follow a different naming pattern to the default one.
//
// TODO(b/155480189) - Remove once naming inconsistencies have been resolved.
Naming_scheme *string
// Specifies whether this module can be used as an Android shared library; defaults
// to true.
//
@@ -915,8 +905,6 @@ type commonToSdkLibraryAndImport struct {
scopePaths map[*apiScope]*scopePaths
namingScheme sdkLibraryComponentNamingScheme
commonSdkLibraryProperties commonToSdkLibraryAndImportProperties
// Paths to commonSdkLibraryProperties.Doctag_files
@@ -944,15 +932,6 @@ func (c *commonToSdkLibraryAndImport) initCommon(module commonSdkLibraryAndImpor
}
func (c *commonToSdkLibraryAndImport) initCommonAfterDefaultsApplied(ctx android.DefaultableHookContext) bool {
schemeProperty := proptools.StringDefault(c.commonSdkLibraryProperties.Naming_scheme, "default")
switch schemeProperty {
case "default":
c.namingScheme = &defaultNamingScheme{}
default:
ctx.PropertyErrorf("naming_scheme", "expected 'default' but was %q", schemeProperty)
return false
}
namePtr := proptools.StringPtr(c.module.RootLibraryName())
c.sdkLibraryComponentProperties.SdkLibraryName = namePtr
@@ -995,41 +974,41 @@ 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.RootLibraryName()
return c.namingScheme.stubsLibraryModuleName(apiScope, baseName)
return apiScope.stubsLibraryModuleName(baseName)
}
// Name of the java_library module that compiles the exportable stubs source.
func (c *commonToSdkLibraryAndImport) exportableStubsLibraryModuleName(apiScope *apiScope) string {
baseName := c.module.RootLibraryName()
return c.namingScheme.exportableStubsLibraryModuleName(apiScope, baseName)
return apiScope.exportableStubsLibraryModuleName(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.RootLibraryName()
return c.namingScheme.stubsSourceModuleName(apiScope, baseName)
return apiScope.stubsSourceModuleName(baseName)
}
// Name of the java_api_library module that generates the from-text stubs source
// and compiles to a jar file.
func (c *commonToSdkLibraryAndImport) apiLibraryModuleName(apiScope *apiScope) string {
baseName := c.module.RootLibraryName()
return c.namingScheme.apiLibraryModuleName(apiScope, baseName)
return apiScope.apiLibraryModuleName(baseName)
}
// Name of the java_library module that compiles the stubs
// generated from source Java files.
func (c *commonToSdkLibraryAndImport) sourceStubsLibraryModuleName(apiScope *apiScope) string {
baseName := c.module.RootLibraryName()
return c.namingScheme.sourceStubsLibraryModuleName(apiScope, baseName)
return apiScope.sourceStubsLibraryModuleName(baseName)
}
// Name of the java_library module that compiles the exportable stubs
// generated from source Java files.
func (c *commonToSdkLibraryAndImport) exportableSourceStubsLibraryModuleName(apiScope *apiScope) string {
baseName := c.module.RootLibraryName()
return c.namingScheme.exportableSourceStubsLibraryModuleName(apiScope, baseName)
return apiScope.exportableSourceStubsLibraryModuleName(baseName)
}
// The component names for different outputs of the java_sdk_library.
@@ -2395,50 +2374,6 @@ func (module *SdkLibrary) defaultsToStubs() bool {
return proptools.Bool(module.sdkLibraryProperties.Default_to_stubs)
}
// Defines how to name the individual component modules the sdk library creates.
type sdkLibraryComponentNamingScheme interface {
stubsLibraryModuleName(scope *apiScope, baseName string) string
stubsSourceModuleName(scope *apiScope, baseName string) string
apiLibraryModuleName(scope *apiScope, baseName string) string
sourceStubsLibraryModuleName(scope *apiScope, baseName string) string
exportableStubsLibraryModuleName(scope *apiScope, baseName string) string
exportableSourceStubsLibraryModuleName(scope *apiScope, baseName string) string
}
type defaultNamingScheme struct {
}
func (s *defaultNamingScheme) stubsLibraryModuleName(scope *apiScope, baseName string) string {
return scope.stubsLibraryModuleName(baseName)
}
func (s *defaultNamingScheme) stubsSourceModuleName(scope *apiScope, baseName string) string {
return scope.stubsSourceModuleName(baseName)
}
func (s *defaultNamingScheme) apiLibraryModuleName(scope *apiScope, baseName string) string {
return scope.apiLibraryModuleName(baseName)
}
func (s *defaultNamingScheme) sourceStubsLibraryModuleName(scope *apiScope, baseName string) string {
return scope.sourceStubLibraryModuleName(baseName)
}
func (s *defaultNamingScheme) exportableStubsLibraryModuleName(scope *apiScope, baseName string) string {
return scope.exportableStubsLibraryModuleName(baseName)
}
func (s *defaultNamingScheme) exportableSourceStubsLibraryModuleName(scope *apiScope, baseName string) string {
return scope.exportableSourceStubsLibraryModuleName(baseName)
}
var _ sdkLibraryComponentNamingScheme = (*defaultNamingScheme)(nil)
func moduleStubLinkType(j *Module) (stub bool, ret sdkLinkType) {
kind := android.ToSdkKind(proptools.String(j.properties.Stub_contributing_api))
switch kind {
@@ -3510,7 +3445,6 @@ func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMembe
}
}
s.Naming_scheme = sdk.commonSdkLibraryProperties.Naming_scheme
s.Shared_library = proptools.BoolPtr(sdk.sharedLibrary())
s.Compile_dex = sdk.dexProperties.Compile_dex
s.Doctag_paths = sdk.doctagPaths

View File

@@ -422,7 +422,7 @@ func TestJavaSdkLibrary_StubOrImplOnlyLibs(t *testing.T) {
for _, expectation := range expectations {
verify("sdklib.impl", expectation.lib, expectation.on_impl_classpath, expectation.in_impl_combined)
stubName := apiScopePublic.sourceStubLibraryModuleName("sdklib")
stubName := apiScopePublic.sourceStubsLibraryModuleName("sdklib")
verify(stubName, expectation.lib, expectation.on_stub_classpath, expectation.in_stub_combined)
}
}

View File

@@ -1703,61 +1703,6 @@ java_sdk_library_import {
)
}
func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
}
java_sdk_library {
name: "myjavalib",
apex_available: ["//apex_available:anyapex"],
srcs: ["Test.java"],
sdk_version: "current",
naming_scheme: "default",
public: {
enabled: true,
},
}
`)
CheckSnapshot(t, result, "mysdk", "",
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
visibility: ["//visibility:public"],
apex_available: ["//apex_available:anyapex"],
naming_scheme: "default",
shared_library: true,
public: {
jars: ["sdk_library/public/myjavalib-stubs.jar"],
stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
current_api: "sdk_library/public/myjavalib.txt",
removed_api: "sdk_library/public/myjavalib-removed.txt",
sdk_version: "current",
},
}
`),
checkAllCopyRules(`
.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
),
)
}
func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJavaSdkLibrary,