Share vdex files in the ART apex between architectures (via symlinks).

Test: aosp_walleye-userdebug boots.

Test: Check symlinks to *.vdex files in the ART apex:
$ adb shell 'find /apex/com.android.art -name '*.vdex' | xargs ls -l'
  lrw-r--r-- 1 system system   23 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-apache-xml.vdex -> ../boot-apache-xml.vdex
  lrw-r--r-- 1 system system   25 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-bouncycastle.vdex -> ../boot-bouncycastle.vdex
  lrw-r--r-- 1 system system   23 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-core-icu4j.vdex -> ../boot-core-icu4j.vdex
  lrw-r--r-- 1 system system   24 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-core-libart.vdex -> ../boot-core-libart.vdex
  lrw-r--r-- 1 system system   19 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot-okhttp.vdex -> ../boot-okhttp.vdex
  lrw-r--r-- 1 system system   12 1970-01-01 01:00 /apex/com.android.art/javalib/arm/boot.vdex -> ../boot.vdex
  lrw-r--r-- 1 system system   23 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-apache-xml.vdex -> ../boot-apache-xml.vdex
  lrw-r--r-- 1 system system   25 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-bouncycastle.vdex -> ../boot-bouncycastle.vdex
  lrw-r--r-- 1 system system   23 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-core-icu4j.vdex -> ../boot-core-icu4j.vdex
  lrw-r--r-- 1 system system   24 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-core-libart.vdex -> ../boot-core-libart.vdex
  lrw-r--r-- 1 system system   19 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot-okhttp.vdex -> ../boot-okhttp.vdex
  lrw-r--r-- 1 system system   12 1970-01-01 01:00 /apex/com.android.art/javalib/arm64/boot.vdex -> ../boot.vdex
  -rw-r--r-- 1 system system 1229 1970-01-01 01:00 /apex/com.android.art/javalib/boot-apache-xml.vdex
  -rw-r--r-- 1 system system 2043 1970-01-01 01:00 /apex/com.android.art/javalib/boot-bouncycastle.vdex
  -rw-r--r-- 1 system system 2883 1970-01-01 01:00 /apex/com.android.art/javalib/boot-core-icu4j.vdex
  -rw-r--r-- 1 system system  865 1970-01-01 01:00 /apex/com.android.art/javalib/boot-core-libart.vdex
  -rw-r--r-- 1 system system  395 1970-01-01 01:00 /apex/com.android.art/javalib/boot-okhttp.vdex
  -rw-r--r-- 1 system system 7125 1970-01-01 01:00 /apex/com.android.art/javalib/boot.vdex

Bug: 150934453

Change-Id: Ifbceb845749f4c218693f4118e8b35b59ff26de1
This commit is contained in:
Ulya Trafimovich
2020-03-11 11:19:26 +00:00
parent c097e36172
commit 5b88fe36b5
3 changed files with 45 additions and 10 deletions

View File

@@ -187,19 +187,31 @@ type dexpreoptBootJars struct {
}
// Accessor function for the apex package. Returns nil if dexpreopt is disabled.
func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.OutputPaths {
func DexpreoptedArtApexJars(ctx android.BuilderContext) (map[android.ArchType]android.OutputPaths, android.OutputPaths) {
if skipDexpreoptBootJars(ctx) {
return nil
return nil, nil
}
// Include dexpreopt files for the primary boot image.
files := map[android.ArchType]android.OutputPaths{}
for _, variant := range artBootImageConfig(ctx).variants {
image := artBootImageConfig(ctx)
// Target-independent boot image files (*.vdex).
anyTarget := image.variants[0].target
vdexDir := image.dir.Join(ctx, anyTarget.Os.String(), image.installSubdir, anyTarget.Arch.ArchType.String())
vdexFiles := image.moduleFiles(ctx, vdexDir, ".vdex")
// Target-specific boot image files (*.oat, *.art).
artAndOatFiles := map[android.ArchType]android.OutputPaths{}
for _, variant := range image.variants {
// We also generate boot images for host (for testing), but we don't need those in the apex.
if variant.target.Os == android.Android {
files[variant.target.Arch.ArchType] = variant.imagesDeps
os := variant.target.Os
if os == android.Android {
arch := variant.target.Arch.ArchType
archDir := image.dir.Join(ctx, os.String(), image.installSubdir, arch.String())
artAndOatFiles[arch] = image.moduleFiles(ctx, archDir, ".art", ".oat")
}
}
return files
return artAndOatFiles, vdexFiles
}
// dexpreoptBoot singleton rules