diff options
| author | Jiakai Zhang <jiakaiz@google.com> | 2023-05-08 16:28:38 +0000 |
|---|---|---|
| committer | Jiakai Zhang <jiakaiz@google.com> | 2023-05-08 21:28:13 +0100 |
| commit | bc698cd28aa2ee17af208bfd56f003347116ddb0 (patch) | |
| tree | c5010d80692fd66cf53b61c3fc8b4a9e23f4e331 /dexpreopt | |
| parent | e3f0281b8897da1fe23b2f4f3a05f1dc87bcc902 (diff) | |
Revert^2 "Generate boot image 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: I5f7f746ca1d4da660fe0c40115e6c71750dfdccc
Diffstat (limited to 'dexpreopt')
| -rw-r--r-- | dexpreopt/config.go | 9 | ||||
| -rw-r--r-- | dexpreopt/testing.go | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/dexpreopt/config.go b/dexpreopt/config.go index 609a29c2d..0cc3bd63b 100644 --- a/dexpreopt/config.go +++ b/dexpreopt/config.go @@ -475,7 +475,16 @@ func RegisterToolDeps(ctx android.BottomUpMutatorContext) { ctx.AddFarVariationDependencies(v, Dex2oatDepTag, dex2oatBin) } +func IsDex2oatNeeded(ctx android.PathContext) bool { + global := GetGlobalConfig(ctx) + return !global.DisablePreopt || !global.DisablePreoptBootImages +} + func dex2oatPathFromDep(ctx android.ModuleContext) android.Path { + if !IsDex2oatNeeded(ctx) { + return nil + } + dex2oatBin := dex2oatModuleName(ctx.Config()) // Find the right dex2oat module, trying to follow PrebuiltDepTag from source diff --git a/dexpreopt/testing.go b/dexpreopt/testing.go index 47ae494e3..b3dd3cca2 100644 --- a/dexpreopt/testing.go +++ b/dexpreopt/testing.go @@ -174,3 +174,10 @@ func FixtureDisableGenerateProfile(disable bool) android.FixturePreparer { dexpreoptConfig.DisableGenerateProfile = disable }) } + +// FixtureDisableDexpreoptBootImages sets the DisablePreoptBootImages property in the global config. +func FixtureDisableDexpreoptBootImages(disable bool) android.FixturePreparer { + return FixtureModifyGlobalConfig(func(_ android.PathContext, dexpreoptConfig *GlobalConfig) { + dexpreoptConfig.DisablePreoptBootImages = disable + }) +} |
