Merge "Change OnlyPreoptBootImageAndSystemServer to OnlyPreoptArtBootImage." into main am: 34778a9301

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2822402

Change-Id: Ib046322e1c6c6416b9e156630db46f7f8fe5c59f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-11-10 19:20:07 +00:00 committed by Automerger Merge Worker
commit 1c9977aece
5 changed files with 45 additions and 49 deletions

View file

@ -32,7 +32,7 @@ type GlobalConfig struct {
DisablePreoptBootImages bool // disable prepot for boot images DisablePreoptBootImages bool // disable prepot for boot images
DisablePreoptModules []string // modules with preopt disabled by product-specific config DisablePreoptModules []string // modules with preopt disabled by product-specific config
OnlyPreoptBootImageAndSystemServer bool // only preopt jars in the boot image or system server OnlyPreoptArtBootImage bool // only preopt jars in the ART boot image
PreoptWithUpdatableBcp bool // If updatable boot jars are included in dexpreopt or not. PreoptWithUpdatableBcp bool // If updatable boot jars are included in dexpreopt or not.
@ -691,45 +691,45 @@ func (s *globalSoongConfigSingleton) MakeVars(ctx android.MakeVarsContext) {
func GlobalConfigForTests(ctx android.PathContext) *GlobalConfig { func GlobalConfigForTests(ctx android.PathContext) *GlobalConfig {
return &GlobalConfig{ return &GlobalConfig{
DisablePreopt: false, DisablePreopt: false,
DisablePreoptModules: nil, DisablePreoptModules: nil,
OnlyPreoptBootImageAndSystemServer: false, OnlyPreoptArtBootImage: false,
HasSystemOther: false, HasSystemOther: false,
PatternsOnSystemOther: nil, PatternsOnSystemOther: nil,
DisableGenerateProfile: false, DisableGenerateProfile: false,
ProfileDir: "", ProfileDir: "",
BootJars: android.EmptyConfiguredJarList(), BootJars: android.EmptyConfiguredJarList(),
ApexBootJars: android.EmptyConfiguredJarList(), ApexBootJars: android.EmptyConfiguredJarList(),
ArtApexJars: android.EmptyConfiguredJarList(), ArtApexJars: android.EmptyConfiguredJarList(),
TestOnlyArtBootImageJars: android.EmptyConfiguredJarList(), TestOnlyArtBootImageJars: android.EmptyConfiguredJarList(),
SystemServerJars: android.EmptyConfiguredJarList(), SystemServerJars: android.EmptyConfiguredJarList(),
SystemServerApps: nil, SystemServerApps: nil,
ApexSystemServerJars: android.EmptyConfiguredJarList(), ApexSystemServerJars: android.EmptyConfiguredJarList(),
StandaloneSystemServerJars: android.EmptyConfiguredJarList(), StandaloneSystemServerJars: android.EmptyConfiguredJarList(),
ApexStandaloneSystemServerJars: android.EmptyConfiguredJarList(), ApexStandaloneSystemServerJars: android.EmptyConfiguredJarList(),
SpeedApps: nil, SpeedApps: nil,
PreoptFlags: nil, PreoptFlags: nil,
DefaultCompilerFilter: "", DefaultCompilerFilter: "",
SystemServerCompilerFilter: "", SystemServerCompilerFilter: "",
GenerateDMFiles: false, GenerateDMFiles: false,
NoDebugInfo: false, NoDebugInfo: false,
DontResolveStartupStrings: false, DontResolveStartupStrings: false,
AlwaysSystemServerDebugInfo: false, AlwaysSystemServerDebugInfo: false,
NeverSystemServerDebugInfo: false, NeverSystemServerDebugInfo: false,
AlwaysOtherDebugInfo: false, AlwaysOtherDebugInfo: false,
NeverOtherDebugInfo: false, NeverOtherDebugInfo: false,
IsEng: false, IsEng: false,
SanitizeLite: false, SanitizeLite: false,
DefaultAppImages: false, DefaultAppImages: false,
Dex2oatXmx: "", Dex2oatXmx: "",
Dex2oatXms: "", Dex2oatXms: "",
EmptyDirectory: "empty_dir", EmptyDirectory: "empty_dir",
CpuVariant: nil, CpuVariant: nil,
InstructionSetFeatures: nil, InstructionSetFeatures: nil,
BootImageProfiles: nil, BootImageProfiles: nil,
BootFlags: "", BootFlags: "",
Dex2oatImageXmx: "", Dex2oatImageXmx: "",
Dex2oatImageXms: "", Dex2oatImageXms: "",
} }
} }

View file

@ -124,12 +124,7 @@ func dexpreoptDisabled(ctx android.PathContext, global *GlobalConfig, module *Mo
return true return true
} }
// If OnlyPreoptBootImageAndSystemServer=true and module is not in boot class path skip if global.OnlyPreoptArtBootImage && !module.PreoptExtractedApk {
// Also preopt system server jars since selinux prevents system server from loading anything from
// /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.
if global.OnlyPreoptBootImageAndSystemServer && !global.BootJars.ContainsJar(module.Name) &&
!global.AllSystemServerJars(ctx).ContainsJar(module.Name) && !module.PreoptExtractedApk {
return true return true
} }

View file

@ -1584,7 +1584,7 @@ func (u *usesLibrary) verifyUsesLibraries(ctx android.ModuleContext, inputFile a
// non-linux build platforms where dexpreopt is generally disabled (the check may fail due to // non-linux build platforms where dexpreopt is generally disabled (the check may fail due to
// various unrelated reasons, such as a failure to get manifest from an APK). // various unrelated reasons, such as a failure to get manifest from an APK).
global := dexpreopt.GetGlobalConfig(ctx) global := dexpreopt.GetGlobalConfig(ctx)
if global.DisablePreopt || global.OnlyPreoptBootImageAndSystemServer { if global.DisablePreopt || global.OnlyPreoptArtBootImage {
return inputFile return inputFile
} }

View file

@ -610,7 +610,8 @@ func generateBootImage(ctx android.ModuleContext, imageConfig *bootImageConfig)
profile := bootImageProfileRule(ctx, imageConfig) profile := bootImageProfileRule(ctx, imageConfig)
// If dexpreopt of boot image jars should be skipped, stop after generating a profile. // If dexpreopt of boot image jars should be skipped, stop after generating a profile.
if SkipDexpreoptBootJars(ctx) { global := dexpreopt.GetGlobalConfig(ctx)
if SkipDexpreoptBootJars(ctx) || (global.OnlyPreoptArtBootImage && imageConfig.name != "art") {
return return
} }

View file

@ -68,7 +68,7 @@ func (m *dexpreoptSystemserverCheck) GenerateAndroidBuildActions(ctx android.Mod
// The check should be skipped on unbundled builds because system server jars are not preopted on // The check should be skipped on unbundled builds because system server jars are not preopted on
// unbundled builds since the artifacts are installed into the system image, not the APEXes. // unbundled builds since the artifacts are installed into the system image, not the APEXes.
if global.DisablePreopt || len(targets) == 0 || ctx.Config().UnbundledBuild() { if global.DisablePreopt || global.OnlyPreoptArtBootImage || len(targets) == 0 || ctx.Config().UnbundledBuild() {
return return
} }