Merge "Make SystemServerJars ConfiguredJarList."

This commit is contained in:
satayev 2021-05-06 11:32:39 +00:00 committed by Gerrit Code Review
commit 63bc30fc12
4 changed files with 10 additions and 11 deletions

View file

@ -49,7 +49,7 @@ type GlobalConfig struct {
ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX
SystemServerJars []string // jars that form the system server SystemServerJars android.ConfiguredJarList // jars that form the system server
SystemServerApps []string // apps that are loaded into system server SystemServerApps []string // apps that are loaded into system server
UpdatableSystemServerJars android.ConfiguredJarList // jars within apex that are loaded into system server UpdatableSystemServerJars android.ConfiguredJarList // jars within apex that are loaded into system server
SpeedApps []string // apps that should be speed optimized SpeedApps []string // apps that should be speed optimized
@ -604,7 +604,7 @@ func GlobalConfigForTests(ctx android.PathContext) *GlobalConfig {
BootJars: android.EmptyConfiguredJarList(), BootJars: android.EmptyConfiguredJarList(),
UpdatableBootJars: android.EmptyConfiguredJarList(), UpdatableBootJars: android.EmptyConfiguredJarList(),
ArtApexJars: android.EmptyConfiguredJarList(), ArtApexJars: android.EmptyConfiguredJarList(),
SystemServerJars: nil, SystemServerJars: android.EmptyConfiguredJarList(),
SystemServerApps: nil, SystemServerApps: nil,
UpdatableSystemServerJars: android.EmptyConfiguredJarList(), UpdatableSystemServerJars: android.EmptyConfiguredJarList(),
SpeedApps: nil, SpeedApps: nil,

View file

@ -120,7 +120,7 @@ func dexpreoptDisabled(ctx android.PathContext, global *GlobalConfig, module *Mo
// /data. If we don't do this they will need to be extracted which is not favorable for RAM usage // /data. If we don't do this they will need to be extracted which is not favorable for RAM usage
// or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options. // or performance. If PreoptExtractedApk is true, we ignore the only preopt boot image options.
if global.OnlyPreoptBootImageAndSystemServer && !global.BootJars.ContainsJar(module.Name) && if global.OnlyPreoptBootImageAndSystemServer && !global.BootJars.ContainsJar(module.Name) &&
!contains(global.SystemServerJars, module.Name) && !module.PreoptExtractedApk { !global.SystemServerJars.ContainsJar(module.Name) && !module.PreoptExtractedApk {
return true return true
} }
@ -362,7 +362,7 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
if !android.PrefixInList(preoptFlags, "--compiler-filter=") { if !android.PrefixInList(preoptFlags, "--compiler-filter=") {
var compilerFilter string var compilerFilter string
if contains(global.SystemServerJars, module.Name) { if global.SystemServerJars.ContainsJar(module.Name) {
// Jars of system server, use the product option if it is set, speed otherwise. // Jars of system server, use the product option if it is set, speed otherwise.
if global.SystemServerCompilerFilter != "" { if global.SystemServerCompilerFilter != "" {
compilerFilter = global.SystemServerCompilerFilter compilerFilter = global.SystemServerCompilerFilter
@ -416,7 +416,7 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
// PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO. // PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
// PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO. // PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
if contains(global.SystemServerJars, module.Name) { if global.SystemServerJars.ContainsJar(module.Name) {
if global.AlwaysSystemServerDebugInfo { if global.AlwaysSystemServerDebugInfo {
debugInfo = true debugInfo = true
} else if global.NeverSystemServerDebugInfo { } else if global.NeverSystemServerDebugInfo {
@ -524,7 +524,7 @@ var nonUpdatableSystemServerJarsKey = android.NewOnceKey("nonUpdatableSystemServ
// from java subpackage to dexpreopt. // from java subpackage to dexpreopt.
func NonUpdatableSystemServerJars(ctx android.PathContext, global *GlobalConfig) []string { func NonUpdatableSystemServerJars(ctx android.PathContext, global *GlobalConfig) []string {
return ctx.Config().Once(nonUpdatableSystemServerJarsKey, func() interface{} { return ctx.Config().Once(nonUpdatableSystemServerJarsKey, func() interface{} {
return android.RemoveListFromList(global.SystemServerJars, global.UpdatableSystemServerJars.CopyOfJars()) return android.RemoveListFromList(global.SystemServerJars.CopyOfJars(), global.UpdatableSystemServerJars.CopyOfJars())
}).([]string) }).([]string)
} }

View file

@ -150,7 +150,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
global := dexpreopt.GetGlobalConfig(ctx) global := dexpreopt.GetGlobalConfig(ctx)
isSystemServerJar := inList(ctx.ModuleName(), global.SystemServerJars) isSystemServerJar := global.SystemServerJars.ContainsJar(ctx.ModuleName())
bootImage := defaultBootImageConfig(ctx) bootImage := defaultBootImageConfig(ctx)
if global.UseArtImage { if global.UseArtImage {

View file

@ -39,10 +39,9 @@ func systemServerClasspath(ctx android.PathContext) []string {
// 2) The jars that are from an updatable apex. // 2) The jars that are from an updatable apex.
systemServerClasspathLocations = append(systemServerClasspathLocations, systemServerClasspathLocations = append(systemServerClasspathLocations,
global.UpdatableSystemServerJars.DevicePaths(ctx.Config(), android.Android)...) global.UpdatableSystemServerJars.DevicePaths(ctx.Config(), android.Android)...)
if len(systemServerClasspathLocations) != len(global.SystemServerJars)+global.UpdatableSystemServerJars.Len() {
panic(fmt.Errorf("Wrong number of system server jars, got %d, expected %d", if expectedLen := global.SystemServerJars.Len() + global.UpdatableSystemServerJars.Len(); expectedLen != len(systemServerClasspathLocations) {
len(systemServerClasspathLocations), panic(fmt.Errorf("wrong number of system server jars, got %d, expected %d", len(systemServerClasspathLocations), expectedLen))
len(global.SystemServerJars)+global.UpdatableSystemServerJars.Len()))
} }
return systemServerClasspathLocations return systemServerClasspathLocations
}) })