Utilize from text core platform api surface jar in build
Use JavaApiLibraryName function to redirect the usage of core platform api stubs from .txt files based on config. Test: m --build-from-text-stub Change-Id: I926a0a455fed301ba4ff9dfa509d4dbbbd076029
This commit is contained in:
@@ -100,6 +100,15 @@ func JavaApiLibraryName(c Config, name string) string {
|
|||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JavaApiLibraryNames applies JavaApiLibraryName to the list of java_library names.
|
||||||
|
func JavaApiLibraryNames(c Config, names []string) []string {
|
||||||
|
apiLibs := make([]string, len(names))
|
||||||
|
for i, name := range names {
|
||||||
|
apiLibs[i] = JavaApiLibraryName(c, name)
|
||||||
|
}
|
||||||
|
return apiLibs
|
||||||
|
}
|
||||||
|
|
||||||
func (k SdkKind) DefaultJavaLibraryName() string {
|
func (k SdkKind) DefaultJavaLibraryName() string {
|
||||||
switch k {
|
switch k {
|
||||||
case SdkPublic:
|
case SdkPublic:
|
||||||
|
@@ -1923,9 +1923,12 @@ type moduleWithSdkDep interface {
|
|||||||
|
|
||||||
func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) {
|
func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) {
|
||||||
switch name {
|
switch name {
|
||||||
case android.SdkCore.JavaLibraryName(ctx.Config()), "legacy.core.platform.api.stubs", "stable.core.platform.api.stubs",
|
case android.SdkCore.JavaLibraryName(ctx.Config()),
|
||||||
|
android.JavaApiLibraryName(ctx.Config(), "legacy.core.platform.api.stubs"),
|
||||||
|
android.JavaApiLibraryName(ctx.Config(), "stable.core.platform.api.stubs"),
|
||||||
"stub-annotations", "private-stub-annotations-jar",
|
"stub-annotations", "private-stub-annotations-jar",
|
||||||
"core-lambda-stubs", "core-generated-annotation-stubs":
|
android.JavaApiLibraryName(ctx.Config(), "core-lambda-stubs"),
|
||||||
|
"core-generated-annotation-stubs":
|
||||||
return javaCore, true
|
return javaCore, true
|
||||||
case android.SdkPublic.JavaLibraryName(ctx.Config()):
|
case android.SdkPublic.JavaLibraryName(ctx.Config()):
|
||||||
return javaSdk, true
|
return javaSdk, true
|
||||||
|
@@ -28,8 +28,11 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||||||
ctx.Strict("FRAMEWORK_LIBRARIES", strings.Join(FrameworkLibraries, " "))
|
ctx.Strict("FRAMEWORK_LIBRARIES", strings.Join(FrameworkLibraries, " "))
|
||||||
|
|
||||||
// These are used by make when LOCAL_PRIVATE_PLATFORM_APIS is set (equivalent to platform_apis in blueprint):
|
// 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_BOOTCLASSPATH_LIBRARIES",
|
||||||
ctx.Strict("LEGACY_CORE_PLATFORM_SYSTEM_MODULES", LegacyCorePlatformSystemModules)
|
strings.Join(android.JavaApiLibraryNames(ctx.Config(), LegacyCorePlatformBootclasspathLibraries), " "))
|
||||||
|
ctx.Strict("LEGACY_CORE_PLATFORM_SYSTEM_MODULES",
|
||||||
|
android.JavaApiLibraryName(ctx.Config(), 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}")
|
||||||
|
@@ -241,7 +241,7 @@ func hiddenAPIComputeMonolithicStubLibModules(config android.Config) map[*Hidden
|
|||||||
testStubModules = append(testStubModules, android.SdkTest.JavaLibraryName(config))
|
testStubModules = append(testStubModules, android.SdkTest.JavaLibraryName(config))
|
||||||
}
|
}
|
||||||
// We do not have prebuilts of the core platform api yet
|
// We do not have prebuilts of the core platform api yet
|
||||||
corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
|
corePlatformStubModules = append(corePlatformStubModules, android.JavaApiLibraryName(config, "legacy.core.platform.api.stubs"))
|
||||||
|
|
||||||
// Allow products to define their own stubs for custom product jars that apps can use.
|
// Allow products to define their own stubs for custom product jars that apps can use.
|
||||||
publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...)
|
publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...)
|
||||||
|
@@ -456,7 +456,9 @@ func sdkDeps(ctx android.BottomUpMutatorContext, sdkContext android.SdkContext,
|
|||||||
ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...)
|
ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...)
|
||||||
ctx.AddVariationDependencies(nil, sdkLibTag, sdkDep.classpath...)
|
ctx.AddVariationDependencies(nil, sdkLibTag, sdkDep.classpath...)
|
||||||
if d.effectiveOptimizeEnabled() && sdkDep.hasStandardLibs() {
|
if d.effectiveOptimizeEnabled() && sdkDep.hasStandardLibs() {
|
||||||
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.LegacyCorePlatformBootclasspathLibraries...)
|
ctx.AddVariationDependencies(nil, proguardRaiseTag,
|
||||||
|
android.JavaApiLibraryNames(ctx.Config(), config.LegacyCorePlatformBootclasspathLibraries)...,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if d.effectiveOptimizeEnabled() && sdkDep.hasFrameworkLibs() {
|
if d.effectiveOptimizeEnabled() && sdkDep.hasFrameworkLibs() {
|
||||||
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.FrameworkLibraries...)
|
ctx.AddVariationDependencies(nil, proguardRaiseTag, config.FrameworkLibraries...)
|
||||||
|
@@ -93,16 +93,16 @@ func useLegacyCorePlatformApi(ctx android.EarlyModuleContext, moduleName string)
|
|||||||
|
|
||||||
func corePlatformSystemModules(ctx android.EarlyModuleContext) string {
|
func corePlatformSystemModules(ctx android.EarlyModuleContext) string {
|
||||||
if useLegacyCorePlatformApi(ctx, ctx.ModuleName()) {
|
if useLegacyCorePlatformApi(ctx, ctx.ModuleName()) {
|
||||||
return config.LegacyCorePlatformSystemModules
|
return android.JavaApiLibraryName(ctx.Config(), config.LegacyCorePlatformSystemModules)
|
||||||
} else {
|
} else {
|
||||||
return config.StableCorePlatformSystemModules
|
return android.JavaApiLibraryName(ctx.Config(), config.StableCorePlatformSystemModules)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func corePlatformBootclasspathLibraries(ctx android.EarlyModuleContext) []string {
|
func corePlatformBootclasspathLibraries(ctx android.EarlyModuleContext) []string {
|
||||||
if useLegacyCorePlatformApi(ctx, ctx.ModuleName()) {
|
if useLegacyCorePlatformApi(ctx, ctx.ModuleName()) {
|
||||||
return config.LegacyCorePlatformBootclasspathLibraries
|
return android.JavaApiLibraryNames(ctx.Config(), config.LegacyCorePlatformBootclasspathLibraries)
|
||||||
} else {
|
} else {
|
||||||
return config.StableCorePlatformBootclasspathLibraries
|
return android.JavaApiLibraryNames(ctx.Config(), config.StableCorePlatformBootclasspathLibraries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user