Merge "Call PackageFile for dexpreopt files of APEX bundles." into main am: 9034af498e am: 0adcd9aefa

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3128073

Change-Id: I967af1f331806ab22e9ba9ddd4481fc630f7180e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-06-13 21:58:43 +00:00
committed by Automerger Merge Worker
3 changed files with 18 additions and 3 deletions

View File

@@ -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 {