Merge "Revert "Share vdex files in the ART apex between architectures (..."" am: 45feb06174
Change-Id: Ib5a6c053bc5cef57a689397832d8f153c1b68f50
This commit is contained in:
17
apex/apex.go
17
apex/apex.go
@@ -2311,10 +2311,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// Build rules are generated by the dexpreopt singleton, and here we access build artifacts
|
// Build rules are generated by the dexpreopt singleton, and here we access build artifacts
|
||||||
// via the global boot image config.
|
// via the global boot image config.
|
||||||
if a.artApex {
|
if a.artApex {
|
||||||
artAndOatFiles, vdexFiles := java.DexpreoptedArtApexJars(ctx)
|
for arch, files := range java.DexpreoptedArtApexJars(ctx) {
|
||||||
|
|
||||||
// Copy *.art and *.oat files to arch-specific subdirectories.
|
|
||||||
for arch, files := range artAndOatFiles {
|
|
||||||
dirInApex := filepath.Join("javalib", arch.String())
|
dirInApex := filepath.Join("javalib", arch.String())
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String())
|
localModule := "javalib_" + arch.String() + "_" + filepath.Base(f.String())
|
||||||
@@ -2322,18 +2319,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
filesInfo = append(filesInfo, af)
|
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 {
|
if a.private_key_file == nil {
|
||||||
|
@@ -333,7 +333,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
for _, fi := range a.filesInfo {
|
for _, fi := range a.filesInfo {
|
||||||
destPath := android.PathForModuleOut(ctx, "image"+suffix, fi.Path()).String()
|
destPath := android.PathForModuleOut(ctx, "image"+suffix, fi.Path()).String()
|
||||||
copyCommands = append(copyCommands, "mkdir -p "+filepath.Dir(destPath))
|
copyCommands = append(copyCommands, "mkdir -p "+filepath.Dir(destPath))
|
||||||
|
|
||||||
if a.linkToSystemLib && fi.transitiveDep && fi.AvailableToPlatform() {
|
if a.linkToSystemLib && fi.transitiveDep && fi.AvailableToPlatform() {
|
||||||
// TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here
|
// TODO(jiyong): pathOnDevice should come from fi.module, not being calculated here
|
||||||
pathOnDevice := filepath.Join("/system", fi.Path())
|
pathOnDevice := filepath.Join("/system", fi.Path())
|
||||||
@@ -342,16 +341,10 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
|
copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
|
||||||
implicitInputs = append(implicitInputs, fi.builtFile)
|
implicitInputs = append(implicitInputs, fi.builtFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// create additional symlinks pointing the file inside the APEX
|
// create additional symlinks pointing the file inside the APEX
|
||||||
for _, symlinkPath := range fi.SymlinkPaths() {
|
for _, symlinkPath := range fi.SymlinkPaths() {
|
||||||
symlinkDest := android.PathForModuleOut(ctx, "image"+suffix, symlinkPath).String()
|
symlinkDest := android.PathForModuleOut(ctx, "image"+suffix, symlinkPath).String()
|
||||||
symlinkTarget, err := filepath.Rel(filepath.Dir(symlinkDest), destPath)
|
copyCommands = append(copyCommands, "ln -sfn "+filepath.Base(destPath)+" "+symlinkDest)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +407,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
readOnlyPaths = append(readOnlyPaths, pathInApex)
|
readOnlyPaths = append(readOnlyPaths, pathInApex)
|
||||||
readOnlyPaths = append(readOnlyPaths, f.SymlinkPaths()...)
|
|
||||||
}
|
}
|
||||||
dir := f.installDir
|
dir := f.installDir
|
||||||
for !android.InList(dir, executablePaths) && dir != "" {
|
for !android.InList(dir, executablePaths) && dir != "" {
|
||||||
|
@@ -186,31 +186,19 @@ type dexpreoptBootJars struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accessor function for the apex package. Returns nil if dexpreopt is disabled.
|
// Accessor function for the apex package. Returns nil if dexpreopt is disabled.
|
||||||
func DexpreoptedArtApexJars(ctx android.BuilderContext) (map[android.ArchType]android.OutputPaths, android.OutputPaths) {
|
func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.OutputPaths {
|
||||||
if skipDexpreoptBootJars(ctx) {
|
if skipDexpreoptBootJars(ctx) {
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
// Include dexpreopt files for the primary boot image.
|
||||||
image := artBootImageConfig(ctx)
|
files := map[android.ArchType]android.OutputPaths{}
|
||||||
|
for _, variant := range artBootImageConfig(ctx).variants {
|
||||||
// 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.
|
// We also generate boot images for host (for testing), but we don't need those in the apex.
|
||||||
os := variant.target.Os
|
if variant.target.Os == android.Android {
|
||||||
if os == android.Android {
|
files[variant.target.Arch.ArchType] = variant.imagesDeps
|
||||||
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
|
// dexpreoptBoot singleton rules
|
||||||
|
Reference in New Issue
Block a user