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

@@ -353,7 +353,7 @@ func dexpreoptCommand(ctx android.BuilderContext, globalSoong *GlobalSoongConfig
}
// Generate command that saves host and target class loader context in shell variables.
paths := ComputeClassLoaderContextDependencies(module.ClassLoaderContexts)
_, paths := ComputeClassLoaderContextDependencies(module.ClassLoaderContexts)
rule.Command().
Text(`eval "$(`).Tool(globalSoong.ConstructContext).
Text(` --target-sdk-version ${target_sdk_version}`).