Cleanup remaining android.JavaApiLibraryName() references
Since the name of the java_library generated from sdk_library per api
scope does not depend on the build configuration anymore, all
dependency switching "magic" via android.JavaApiLibraryName() can be
removed.
This change also removes from-text-build-specific test cases, as those
test cases depend on build configurations.
Test: m nothing && m nothing --build-from-text-stub
Bug: 287340610
Change-Id: I3bac35259e0cbaa16432a46cb2b128951c9bc075
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 108fdd4..50429b0 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -479,8 +479,6 @@
for _, apiScope := range hiddenAPISdkLibrarySupportedScopes {
// Add a dependency onto a possibly scope specific stub library.
scopeSpecificDependency := apiScope.scopeSpecificStubModule(ctx, additionalStubModule)
- // Use JavaApiLibraryName function to be redirected to stubs generated from .txt if applicable
- scopeSpecificDependency = android.JavaApiLibraryName(ctx.Config(), scopeSpecificDependency)
tag := hiddenAPIStubsDependencyTag{apiScope: apiScope, fromAdditionalDependency: true}
ctx.AddVariationDependencies(nil, tag, scopeSpecificDependency)
}
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index 9bdef74..2541f14 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -432,39 +432,3 @@
fragment = result.Module("a_test_fragment", "android_common").(*BootclasspathFragmentModule)
android.AssertBoolEquals(t, "is a test fragment by type", true, fragment.isTestFragment())
}
-
-func TestBootclassFragment_LinkTextStub(t *testing.T) {
- result := android.GroupFixturePreparers(
- prepareForJavaTest,
- prepareForTestWithBootclasspathFragment,
- PrepareForTestWithJavaSdkLibraryFiles,
- FixtureWithLastReleaseApis("mysdklibrary"),
- android.FixtureModifyConfig(func(config android.Config) {
- config.SetBuildFromTextStub(true)
- }),
- ).RunTestWithBp(t, `
- bootclasspath_fragment {
- name: "myfragment",
- contents: ["mysdklibrary"],
- hidden_api: {split_packages: ["*"]},
- additional_stubs: [
- "android-non-updatable",
- ],
- }
- java_sdk_library {
- name: "mysdklibrary",
- srcs: ["a.java"],
- shared_library: false,
- public: {enabled: true},
- system: {enabled: true},
- }
- `)
-
- fragment := result.ModuleForTests("myfragment", "android_common")
- ruleCommand := fragment.Rule("modularHiddenAPIStubFlagsFile").RuleParams.Command
- android.AssertStringDoesContain(t, "Command expected to contain library as dependency stub dex",
- ruleCommand, "--dependency-stub-dex=out/soong/.intermediates/default/java/android-non-updatable.stubs.module_lib.from-text/android_common/dex/android-non-updatable.stubs.module_lib.from-text.jar")
- android.AssertStringDoesNotContain(t,
- "Command not expected to contain multiple api_library as dependency stub dex", ruleCommand,
- "--dependency-stub-dex=out/soong/.intermediates/default/java/android-non-updatable.stubs.from-text/android_common/dex/android-non-updatable.stubs.from-text.jar")
-}
diff --git a/java/config/makevars.go b/java/config/makevars.go
index d383d98..4e09195 100644
--- a/java/config/makevars.go
+++ b/java/config/makevars.go
@@ -29,10 +29,8 @@
// These are used by make when LOCAL_PRIVATE_PLATFORM_APIS is set (equivalent to platform_apis in blueprint):
ctx.Strict("LEGACY_CORE_PLATFORM_BOOTCLASSPATH_LIBRARIES",
- strings.Join(android.JavaApiLibraryNames(ctx.Config(), LegacyCorePlatformBootclasspathLibraries), " "))
- ctx.Strict("LEGACY_CORE_PLATFORM_SYSTEM_MODULES",
- android.JavaApiLibraryName(ctx.Config(), LegacyCorePlatformSystemModules),
- )
+ strings.Join(LegacyCorePlatformBootclasspathLibraries, " "))
+ ctx.Strict("LEGACY_CORE_PLATFORM_SYSTEM_MODULES", LegacyCorePlatformSystemModules)
ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}")
ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}")
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index da9c997..c6b921b 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -647,7 +647,7 @@
// public version is provided by the art.module.public.api module. In those cases it is necessary
// to treat all those modules as they were the same name, otherwise it will result in multiple
// definitions of a single class being passed to hidden API processing which will cause an error.
- if name == scope.nonUpdatablePrebuiltModule || name == android.JavaApiLibraryName(ctx.Config(), scope.nonUpdatableSourceModule) {
+ if name == scope.nonUpdatablePrebuiltModule || name == scope.nonUpdatableSourceModule {
// Treat all *android-non-updatable* modules as if they were part of an android-non-updatable
// java_sdk_library.
// TODO(b/192067200): Remove once android-non-updatable is a java_sdk_library or equivalent.
diff --git a/java/java.go b/java/java.go
index a026610..454f42f 100644
--- a/java/java.go
+++ b/java/java.go
@@ -459,7 +459,7 @@
ctx.AddVariationDependencies(nil, sdkLibTag, sdkDep.classpath...)
if d.effectiveOptimizeEnabled() && sdkDep.hasStandardLibs() {
ctx.AddVariationDependencies(nil, proguardRaiseTag,
- android.JavaApiLibraryNames(ctx.Config(), config.LegacyCorePlatformBootclasspathLibraries)...,
+ config.LegacyCorePlatformBootclasspathLibraries...,
)
}
if d.effectiveOptimizeEnabled() && sdkDep.hasFrameworkLibs() {
diff --git a/java/legacy_core_platform_api_usage.go b/java/legacy_core_platform_api_usage.go
index 04c6d05..6cb549e 100644
--- a/java/legacy_core_platform_api_usage.go
+++ b/java/legacy_core_platform_api_usage.go
@@ -93,16 +93,16 @@
func corePlatformSystemModules(ctx android.EarlyModuleContext) string {
if useLegacyCorePlatformApi(ctx, ctx.ModuleName()) {
- return android.JavaApiLibraryName(ctx.Config(), config.LegacyCorePlatformSystemModules)
+ return config.LegacyCorePlatformSystemModules
} else {
- return android.JavaApiLibraryName(ctx.Config(), config.StableCorePlatformSystemModules)
+ return config.StableCorePlatformSystemModules
}
}
func corePlatformBootclasspathLibraries(ctx android.EarlyModuleContext) []string {
if useLegacyCorePlatformApi(ctx, ctx.ModuleName()) {
- return android.JavaApiLibraryNames(ctx.Config(), config.LegacyCorePlatformBootclasspathLibraries)
+ return config.LegacyCorePlatformBootclasspathLibraries
} else {
- return android.JavaApiLibraryNames(ctx.Config(), config.StableCorePlatformBootclasspathLibraries)
+ return config.StableCorePlatformBootclasspathLibraries
}
}
diff --git a/java/sdk.go b/java/sdk.go
index 7699aab..7c702c4 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -148,7 +148,7 @@
toModule := func(module string, aidl android.Path) sdkDep {
// Select the kind of system modules needed for the sdk version.
systemModulesKind := systemModuleKind(sdkVersion.Kind, android.FutureApiLevel)
- systemModules := android.JavaApiLibraryName(ctx.Config(), fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind))
+ systemModules := fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind)
return sdkDep{
useModule: true,
bootclasspath: []string{module, config.DefaultLambdaStubsLibrary},
@@ -198,7 +198,7 @@
return sdkDep{
useModule: true,
bootclasspath: []string{android.SdkCore.DefaultJavaLibraryName(), config.DefaultLambdaStubsLibrary},
- systemModules: android.JavaApiLibraryName(ctx.Config(), "core-public-stubs-system-modules"),
+ systemModules: "core-public-stubs-system-modules",
noFrameworksLibs: true,
}
case android.SdkModule: