Call PackageFile for dexpreopt files
Dexpreopt files use RuleBuilder.Install() that installs the file from
Make. By calling PackageFile, this information is also shared to
soong PackagingSpec.
Bug: 339314890
Test: See if .prof, .bprof, and vdex files are installed with
"m aosp_cf_system_x86_64"
Change-Id: I42167603ecfd4334e4f35602bdf03a21846fc798
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 7229ca0..defa82c 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -612,6 +612,9 @@
profileInstalls: profileInstalls,
profileLicenseMetadataFile: android.OptionalPathForPath(ctx.LicenseMetadataFile()),
})
+ for _, install := range profileInstalls {
+ packageFile(ctx, install)
+ }
}
}
@@ -929,6 +932,35 @@
return apexNameToApexExportsInfoMap
}
+func packageFileForTargetImage(ctx android.ModuleContext, image *bootImageVariant) {
+ if image.target.Os != ctx.Os() {
+ // This is not for the target device.
+ return
+ }
+
+ for _, install := range image.installs {
+ packageFile(ctx, install)
+ }
+
+ for _, install := range image.vdexInstalls {
+ if image.target.Arch.ArchType.Name != ctx.DeviceConfig().DeviceArch() {
+ // Note that the vdex files are identical between architectures. If the target image is
+ // not for the primary architecture create symlinks to share the vdex of the primary
+ // architecture with the other architectures.
+ //
+ // Assuming that the install path has the architecture name with it, replace the
+ // architecture name with the primary architecture name to find the source vdex file.
+ installPath, relDir, name := getModuleInstallPathInfo(ctx, install.To)
+ if name != "" {
+ srcRelDir := strings.Replace(relDir, image.target.Arch.ArchType.Name, ctx.DeviceConfig().DeviceArch(), 1)
+ ctx.InstallSymlink(installPath.Join(ctx, relDir), name, installPath.Join(ctx, srcRelDir, name))
+ }
+ } else {
+ packageFile(ctx, install)
+ }
+ }
+}
+
// Generate boot image build rules for a specific target.
func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, profile android.Path) bootImageVariantOutputs {
@@ -1123,6 +1155,7 @@
image.installs = rule.Installs()
image.vdexInstalls = vdexInstalls
image.unstrippedInstalls = unstrippedInstalls
+ packageFileForTargetImage(ctx, image)
// Only set the licenseMetadataFile from the active module.
if isActiveModule(ctx, ctx.Module()) {