Revert^2 "Generate app profiles even if dexpreopt is disabled."

Revert submission 2580631-revert-2574032-XXTWCJDTDQ

Reason for revert: Fixed build breakages

Reverted changes: /q/submissionid:2580631-revert-2574032-XXTWCJDTDQ

Bug: 280440941
Test: lunch aosp_cf_riscv64_minidroid-userdebug && m UNSAFE_DISABLE_HIDDENAPI_FLAGS=true dist
Test: Disable dex2oat on host (to simulate macOS) and build
Change-Id: I6090b4b74cedb6d129fcbeef58d075c8ccdcc4e2
This commit is contained in:
Jiakai Zhang
2023-05-08 16:28:38 +00:00
parent bc698cd28a
commit cf61e3c591
6 changed files with 63 additions and 20 deletions

View File

@@ -100,11 +100,19 @@ func GenerateDexpreoptRule(ctx android.BuilderContext, globalSoong *GlobalSoongC
return rule, nil
}
// If dexpreopt is applicable to the module, returns whether dexpreopt is disabled. Otherwise, the
// behavior is undefined.
// When it returns true, dexpreopt artifacts will not be generated, but profile will still be
// generated if profile-guided compilation is requested.
func dexpreoptDisabled(ctx android.PathContext, global *GlobalConfig, module *ModuleConfig) bool {
if ctx.Config().UnbundledBuild() {
return true
}
if global.DisablePreopt {
return true
}
if contains(global.DisablePreoptModules, module.Name) {
return true
}

View File

@@ -181,3 +181,10 @@ func FixtureDisableDexpreoptBootImages(disable bool) android.FixturePreparer {
dexpreoptConfig.DisablePreoptBootImages = disable
})
}
// FixtureDisableDexpreopt sets the DisablePreopt property in the global config.
func FixtureDisableDexpreopt(disable bool) android.FixturePreparer {
return FixtureModifyGlobalConfig(func(_ android.PathContext, dexpreoptConfig *GlobalConfig) {
dexpreoptConfig.DisablePreopt = disable
})
}