summaryrefslogtreecommitdiff
path: root/apex/apex.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2023-12-13 00:06:32 +0000
committer Spandan Das <spandandas@google.com> 2023-12-19 22:37:29 +0000
commitda739a30a6575ae0345e6694da6ff65b1eceabba (patch)
tree09a84b8f6f747610c2ffb1cee0ae2ee3d003cb87 /apex/apex.go
parentfae468ef14fa7fd902c8e004dbd55a3e79b8a30f (diff)
Use the correct prof file when multiple prebuilt apexes exist
Generating boot image requires a .prof file provided by the ART apex. When building with prebuilts, this comes via the prebuilt_bootclasspath_fragment module, which acts as a shim for prebuilt_apex/apex_set. If we have multiple prebuilt apexes in the tree, this shim becomes 1:many. This CL prepares dex_bootjars to select the right .prof file when multiple prebuilts exist. Implementation details - Update deps mutator of dex_bootjars to create a dep on all_apex_contributions. The latter contains information about which apex is selected in a specific release configuration. dex_bootjars will create a dependency on the selected apex in a postdeps phase mutator. - All apex module types (apex, prebuilt_apex and apex_set) will set a provider that contains info about the location of the .prof file on host - dex_bootjars will access the provider of the selected apex to get the location of the .prof file This CL does not drop the old mechanism to get the .prof file (i.e. by creating a dep on {prebuilt_}bootclasspath_fragment). Once all mainline modules have been flagged using apex_contributions, the old mechanism will be dropped Bug: 308790457 Test: Added a unit test that checks that the right .prof is selected when multiple prebuilts exists Change-Id: I40fdb21416c46bed32f6ff187ce5153711ec2c69
Diffstat (limited to 'apex/apex.go')
-rw-r--r--apex/apex.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 56559b16b..b70484cbe 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2371,6 +2371,24 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.buildApex(ctx)
a.buildApexDependencyInfo(ctx)
a.buildLintReports(ctx)
+
+ // Set a provider for dexpreopt of bootjars
+ a.provideApexExportsInfo(ctx)
+}
+
+// Set a provider containing information about the jars and .prof provided by the apex
+// Apexes built from source retrieve this information by visiting `bootclasspath_fragments`
+// Used by dex_bootjars to generate the boot image
+func (a *apexBundle) provideApexExportsInfo(ctx android.ModuleContext) {
+ ctx.VisitDirectDepsWithTag(bcpfTag, func(child android.Module) {
+ if info, ok := android.OtherModuleProvider(ctx, child, java.BootclasspathFragmentApexContentInfoProvider); ok {
+ exports := android.ApexExportsInfo{
+ ApexName: a.ApexVariationName(),
+ ProfilePathOnHost: info.ProfilePathOnHost(),
+ }
+ ctx.SetProvider(android.ApexExportsInfoProvider, exports)
+ }
+ })
}
// apexBootclasspathFragmentFiles returns the list of apexFile structures defining the files that