Use per-app package list to avoid unnecessary dexpreopt.

Starting from aosp/2594905, dexpreopt depends on
`$PRODUCT_OUT/product_packages.txt`. When PRODUCT_PACKAGES changes,
dexpreopt has to rerun for all apps. This is not ideal.

After this change, dexpreopt uses a per-app product_packages.txt that is
filtered by the app's dependencies, and it uses `rsync --checksum` to
prevent the file's mtime from being changed if the contents don't change.
This avoids unnecessary dexpreopt reruns.

Bug: 288218403
Test: m
Test: Change PRODUCT_PACKAGES and see no dexpreopt reruns.
Change-Id: I5788a9ee987dfd0abfd7d91cbcef748452290004
This commit is contained in:
Jiakai Zhang
2023-06-26 16:47:38 +01:00
parent a41c679fe1
commit 51b2a8b5eb
5 changed files with 60 additions and 24 deletions

View File

@@ -2697,7 +2697,7 @@ func TestUsesLibraries(t *testing.T) {
cmd := app.Rule("dexpreopt").RuleParams.Command
android.AssertStringDoesContain(t, "dexpreopt app cmd context", cmd, "--context-json=")
android.AssertStringDoesContain(t, "dexpreopt app cmd product_packages", cmd,
"--product-packages=out/soong/target/product/test_device/product_packages.txt")
"--product-packages=out/soong/.intermediates/app/android_common/dexpreopt/product_packages.txt")
}
func TestDexpreoptBcp(t *testing.T) {