Merge "Share vdex files in the ART apex between architectures (via symlinks)."
This commit is contained in:
17
apex/apex.go
17
apex/apex.go
@@ -2311,7 +2311,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
// Build rules are generated by the dexpreopt singleton, and here we access build artifacts
|
||||
// via the global boot image config.
|
||||
if a.artApex {
|
||||
for arch, files := range java.DexpreoptedArtApexJars(ctx) {
|
||||
artAndOatFiles, vdexFiles := java.DexpreoptedArtApexJars(ctx)
|
||||
|
||||
// Copy *.art and *.oat files to arch-specific subdirectories.
|
||||
for arch, files := range artAndOatFiles {
|
||||
dirInApex := filepath.Join("javalib", arch.String())
|
||||
for _, f := range files {
|
||||
localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String())
|
||||
@@ -2319,6 +2322,18 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
filesInfo = append(filesInfo, af)
|
||||
}
|
||||
}
|
||||
|
||||
// Copy *.vdex files to a common subdirectory.
|
||||
for _, file := range vdexFiles {
|
||||
dirInApex := "javalib"
|
||||
localModule := "javalib_" + filepath.Base(file.String())
|
||||
af := newApexFile(ctx, file, localModule, dirInApex, etc, nil)
|
||||
// Add a symlink to the *.vdex file for each arch-specific subdirectory.
|
||||
for arch := range artAndOatFiles {
|
||||
af.symlinks = append(af.symlinks, filepath.Join(arch.String(), filepath.Base(file.String())))
|
||||
}
|
||||
filesInfo = append(filesInfo, af)
|
||||
}
|
||||
}
|
||||
|
||||
if a.private_key_file == nil {
|
||||
|
||||
@@ -333,6 +333,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
for _, fi := range a.filesInfo {
|
||||
destPath := android.PathForModuleOut(ctx, "image"+suffix, fi.Path()).String()
|
||||
copyCommands = append(copyCommands, "mkdir -p "+filepath.Dir(destPath))
|
||||
|
||||
if a.linkToSystemLib && fi.transitiveDep && fi.AvailableToPlatform() {
|
||||
// TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here
|
||||
pathOnDevice := filepath.Join("/system", fi.Path())
|
||||
@@ -341,10 +342,16 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
|
||||
implicitInputs = append(implicitInputs, fi.builtFile)
|
||||
}
|
||||
|
||||
// create additional symlinks pointing the file inside the APEX
|
||||
for _, symlinkPath := range fi.SymlinkPaths() {
|
||||
symlinkDest := android.PathForModuleOut(ctx, "image"+suffix, symlinkPath).String()
|
||||
copyCommands = append(copyCommands, "ln -sfn "+filepath.Base(destPath)+" "+symlinkDest)
|
||||
symlinkTarget, err := filepath.Rel(filepath.Dir(symlinkDest), destPath)
|
||||
if err != nil {
|
||||
panic("Cannot compute relative path from " + destPath + " to " + filepath.Dir(symlinkDest))
|
||||
}
|
||||
copyCommands = append(copyCommands, "mkdir -p "+filepath.Dir(symlinkDest))
|
||||
copyCommands = append(copyCommands, "ln -sfn "+symlinkTarget+" "+symlinkDest)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,6 +414,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
}
|
||||
} else {
|
||||
readOnlyPaths = append(readOnlyPaths, pathInApex)
|
||||
readOnlyPaths = append(readOnlyPaths, f.SymlinkPaths()...)
|
||||
}
|
||||
dir := f.installDir
|
||||
for !android.InList(dir, executablePaths) && dir != "" {
|
||||
|
||||
Reference in New Issue
Block a user