diff options
author | 2024-01-25 22:12:50 +0000 | |
---|---|---|
committer | 2024-01-30 18:04:52 +0000 | |
commit | 2ea84dd0dc034d982e867e7dec97b713b68ce3bf (patch) | |
tree | 73062cdf6401eef787b7bbd2158213406179a636 /apex/prebuilt.go | |
parent | e21a8d4dc6ef36c7de97254e40acfd389e887a2d (diff) |
Propagate profile_guided requirement of imports to top-level apex
For prebuilts, the dexpreopt rules of system server jars are now
generated from the context of the top-level prebuilt apex and not in the
context of the shim java_import modules. Since
`dex_preopt.profile_guided` property is defined in java_import, this
needs to be bubbled up to the top-level apex. This will be done using
deapxerInfo. If profile_guided of a transitive java_import is true, the deapexed .prof file will be
set as dexreopter.inputProfilePathOnHost before invoking
dexpreopter.dexpreopt. This ensures that only that java_import undergoes
profile guided dexpreopt, and not every other transitive java_import
Test: go test ./apex -run TestPrebuiltStandaloneSystemserverclasspathFragmentContents
Test: lunch cf_x86_64_only_phone-next-userdebug && m
$ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex
Test: du -sh
$ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex
24K
Bug: 308790457
Change-Id: Ibf46ecb400b3f126b243fc8d27b08d9a1aa4cc97
Diffstat (limited to 'apex/prebuilt.go')
-rw-r--r-- | apex/prebuilt.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apex/prebuilt.go b/apex/prebuilt.go index 551942d31..399d9b92f 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -629,6 +629,7 @@ func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutator // Compute the deapexer properties from the transitive dependencies of this module. commonModules := []string{} + dexpreoptProfileGuidedModules := []string{} exportedFiles := []string{} ctx.WalkDeps(func(child, parent android.Module) bool { tag := ctx.OtherModuleDependencyTag(child) @@ -642,9 +643,14 @@ func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutator if _, ok := tag.(android.RequiresFilesFromPrebuiltApexTag); ok { commonModules = append(commonModules, name) - requiredFiles := child.(android.RequiredFilesFromPrebuiltApex).RequiredFilesFromPrebuiltApex(ctx) + extract := child.(android.RequiredFilesFromPrebuiltApex) + requiredFiles := extract.RequiredFilesFromPrebuiltApex(ctx) exportedFiles = append(exportedFiles, requiredFiles...) + if extract.UseProfileGuidedDexpreopt() { + dexpreoptProfileGuidedModules = append(dexpreoptProfileGuidedModules, name) + } + // Visit the dependencies of this module just in case they also require files from the // prebuilt apex. return true @@ -657,7 +663,8 @@ func (p *prebuiltCommon) createDeapexerModuleIfNeeded(ctx android.TopDownMutator deapexerProperties := &DeapexerProperties{ // Remove any duplicates from the common modules lists as a module may be included via a direct // dependency as well as transitive ones. - CommonModules: android.SortedUniqueStrings(commonModules), + CommonModules: android.SortedUniqueStrings(commonModules), + DexpreoptProfileGuidedModules: android.SortedUniqueStrings(dexpreoptProfileGuidedModules), } // Populate the exported files property in a fixed order. |