summaryrefslogtreecommitdiff
path: root/java/dexpreopt.go
diff options
context:
space:
mode:
author Justin Yun <justinyun@google.com> 2024-06-12 21:32:10 +0900
committer Justin Yun <justinyun@google.com> 2024-06-13 12:37:04 +0900
commit613bdc5b646629a461bf1d14647209b9f4c572cd (patch)
tree4471f0f82c9505a8421c2dfc7e73fa56db6cd509 /java/dexpreopt.go
parent22c8aca89318c722b3cab55c39b45e3d7b70be3e (diff)
Call PackageFile for dexpreopt files of APEX bundles.
Soong generates AndroidMk modules and Make installs the required dexpreopt files for APEX bundles. This dependency is not tracked by the soong and missing from the soong filesystem. Call PackageFile for the dexpreopt files of APEX bundles to install the files in the soong-built system image. Bug: 346439786 Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug \ && m aosp_cf_system_x86_64 Change-Id: I6af4afe5b3183c89bf687ac779007b87e1d7e948
Diffstat (limited to 'java/dexpreopt.go')
-rw-r--r--java/dexpreopt.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 57aaa1a2d..794924401 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -96,6 +96,10 @@ func (install dexpreopterInstall) ToMakeEntries() android.AndroidMkEntries {
}
}
+func (install dexpreopterInstall) PackageFile(ctx android.ModuleContext) android.PackagingSpec {
+ return ctx.PackageFile(install.installDirOnDevice, install.installFileOnDevice, install.outputPathOnHost)
+}
+
type Dexpreopter struct {
dexpreopter
}
@@ -541,10 +545,18 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, libName string, dexJa
// Use the path of the dex file to determine the library name
isApexSystemServerJar := global.AllApexSystemServerJars(ctx).ContainsJar(dexJarStem)
- partition := d.installPath.Partition()
+ dexpreoptPartition := d.installPath.Partition()
+ // dexpreoptPartition is set to empty for dexpreopts of system APEX and system_other.
+ // In case of system APEX, however, we can set it to "system" manually.
+ // TODO(b/346662300): Let dexpreopter generate the installPath for dexpreopt files instead of
+ // using the dex location to generate the installPath.
+ if isApexSystemServerJar {
+ dexpreoptPartition = "system"
+ }
for _, install := range dexpreoptRule.Installs() {
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
+ partition := dexpreoptPartition
if strings.HasPrefix(installDir, partition+"/") {
installDir = strings.TrimPrefix(installDir, partition+"/")
} else {