Rename the Default* constants in java/config.

These values are used in two out of the many possible sdk_version
configurations, and therefore weren't really defaults in any
meaningful sense. Giving them more descriptive names makes the code
easier to follow.

Bug: 157640067
Test: m nothing
Change-Id: Icf38a9c0be2606ad0478929e1b40dfcee36cddef
This commit is contained in:
Pete Gillin 2020-07-01 10:48:14 +01:00
parent 40a0642385
commit 0638dfcf94
5 changed files with 28 additions and 27 deletions

View File

@ -28,12 +28,11 @@ import (
var ( var (
pctx = android.NewPackageContext("android/soong/java/config") pctx = android.NewPackageContext("android/soong/java/config")
// TODO(b/157640067): Don't depend on the legacy API by default in the long term. LegacyCorePlatformBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"}
DefaultBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"} LegacyCorePlatformSystemModules = "legacy-core-platform-api-stubs-system-modules"
DefaultSystemModules = "legacy-core-platform-api-stubs-system-modules" FrameworkLibraries = []string{"ext", "framework"}
DefaultLibraries = []string{"ext", "framework"} DefaultLambdaStubsLibrary = "core-lambda-stubs"
DefaultLambdaStubsLibrary = "core-lambda-stubs" SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar"
SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar"
DefaultJacocoExcludeFilter = []string{"org.junit.*", "org.jacoco.*", "org.mockito.*"} DefaultJacocoExcludeFilter = []string{"org.junit.*", "org.jacoco.*", "org.mockito.*"}

View File

@ -25,9 +25,11 @@ func init() {
} }
func makeVarsProvider(ctx android.MakeVarsContext) { func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("TARGET_DEFAULT_JAVA_LIBRARIES", strings.Join(DefaultLibraries, " ")) ctx.Strict("FRAMEWORK_LIBRARIES", strings.Join(FrameworkLibraries, " "))
ctx.Strict("TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES", strings.Join(DefaultBootclasspathLibraries, " "))
ctx.Strict("DEFAULT_SYSTEM_MODULES", DefaultSystemModules) // 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(LegacyCorePlatformBootclasspathLibraries, " "))
ctx.Strict("LEGACY_CORE_PLATFORM_SYSTEM_MODULES", LegacyCorePlatformSystemModules)
ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}") ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}")
ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}") ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}")

View File

@ -441,10 +441,10 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
if ctx.Device() { if ctx.Device() {
sdkDep := decodeSdkDep(ctx, sdkContext(j)) sdkDep := decodeSdkDep(ctx, sdkContext(j))
if sdkDep.useDefaultLibs { if sdkDep.useDefaultLibs {
ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...) ctx.AddVariationDependencies(nil, bootClasspathTag, config.LegacyCorePlatformBootclasspathLibraries...)
ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules) ctx.AddVariationDependencies(nil, systemModulesTag, config.LegacyCorePlatformSystemModules)
if sdkDep.hasFrameworkLibs() { if sdkDep.hasFrameworkLibs() {
ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...) ctx.AddVariationDependencies(nil, libTag, config.FrameworkLibraries...)
} }
} else if sdkDep.useModule { } else if sdkDep.useModule {
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...) ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...)

View File

@ -695,17 +695,17 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
sdkDep := decodeSdkDep(ctx, sdkContext(j)) sdkDep := decodeSdkDep(ctx, sdkContext(j))
if sdkDep.useDefaultLibs { if sdkDep.useDefaultLibs {
ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...) ctx.AddVariationDependencies(nil, bootClasspathTag, config.LegacyCorePlatformBootclasspathLibraries...)
ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules) ctx.AddVariationDependencies(nil, systemModulesTag, config.LegacyCorePlatformSystemModules)
if sdkDep.hasFrameworkLibs() { if sdkDep.hasFrameworkLibs() {
ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...) ctx.AddVariationDependencies(nil, libTag, config.FrameworkLibraries...)
} }
} else if sdkDep.useModule { } else if sdkDep.useModule {
ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...) ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...)
ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...) ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...)
if j.deviceProperties.EffectiveOptimizeEnabled() && sdkDep.hasStandardLibs() { if j.deviceProperties.EffectiveOptimizeEnabled() && sdkDep.hasStandardLibs() {
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultBootclasspathLibraries...) ctx.AddVariationDependencies(nil, proguardRaiseTag, config.LegacyCorePlatformBootclasspathLibraries...)
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultLibraries...) ctx.AddVariationDependencies(nil, proguardRaiseTag, config.FrameworkLibraries...)
} }
} }
if sdkDep.systemModules != "" { if sdkDep.systemModules != "" {

View File

@ -49,27 +49,27 @@ func TestClasspath(t *testing.T) {
}{ }{
{ {
name: "default", name: "default",
bootclasspath: config.DefaultBootclasspathLibraries, bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
system: config.DefaultSystemModules, system: config.LegacyCorePlatformSystemModules,
java8classpath: config.DefaultLibraries, java8classpath: config.FrameworkLibraries,
java9classpath: config.DefaultLibraries, java9classpath: config.FrameworkLibraries,
aidl: "-Iframework/aidl", aidl: "-Iframework/aidl",
}, },
{ {
name: `sdk_version:"core_platform"`, name: `sdk_version:"core_platform"`,
properties: `sdk_version:"core_platform"`, properties: `sdk_version:"core_platform"`,
bootclasspath: config.DefaultBootclasspathLibraries, bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
system: config.DefaultSystemModules, system: config.LegacyCorePlatformSystemModules,
java8classpath: []string{}, java8classpath: []string{},
aidl: "", aidl: "",
}, },
{ {
name: "blank sdk version", name: "blank sdk version",
properties: `sdk_version: "",`, properties: `sdk_version: "",`,
bootclasspath: config.DefaultBootclasspathLibraries, bootclasspath: config.LegacyCorePlatformBootclasspathLibraries,
system: config.DefaultSystemModules, system: config.LegacyCorePlatformSystemModules,
java8classpath: config.DefaultLibraries, java8classpath: config.FrameworkLibraries,
java9classpath: config.DefaultLibraries, java9classpath: config.FrameworkLibraries,
aidl: "-Iframework/aidl", aidl: "-Iframework/aidl",
}, },
{ {