Export boot image files from prebuilt_apex/apex_set
Previously, the prebuilt art-bootclasspath-fragment did not provide any
boot image files. That meant it was impossible to build any module that
requires access to those files from prebuilts, e.g. any module that
needs to be dexpreopt-ed.
This change enables that module to retrieve those files from the
prebuilt_apex.
Bug: 177892522
Bug: 189298093
Test: m nothing
m droid SOONG_CONFIG_art_module_source_build=false SKIP_BOOT_JARS_CHECK=true
- the previous command does not work but this change does fix one
of the issues reported.
Merged-In: I1d4d9545172d79282918130df6b9aa55471bffc1
Change-Id: I1d4d9545172d79282918130df6b9aa55471bffc1
(cherry picked from commit 5466a3699c550d1fa67066db48951b765156be4f)
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index f6539c8..c17f162 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -548,21 +548,36 @@
}
// Compute the deapexer properties from the transitive dependencies of this module.
- javaModules := []string{}
- exportedFiles := map[string]string{}
+ commonModules := []string{}
+ exportedFilesByKey := map[string]string{}
+ requiringModulesByKey := map[string]android.Module{}
ctx.WalkDeps(func(child, parent android.Module) bool {
tag := ctx.OtherModuleDependencyTag(child)
name := android.RemoveOptionalPrebuiltPrefix(ctx.OtherModuleName(child))
if java.IsBootclasspathFragmentContentDepTag(tag) || tag == exportedJavaLibTag {
- javaModules = append(javaModules, name)
+ commonModules = append(commonModules, name)
// Add the dex implementation jar to the set of exported files. The path here must match the
// path of the file in the APEX created by apexFileForJavaModule(...).
- exportedFiles[name+"{.dexjar}"] = filepath.Join("javalib", name+".jar")
+ exportedFilesByKey[name+"{.dexjar}"] = filepath.Join("javalib", name+".jar")
} else if tag == exportedBootclasspathFragmentTag {
- // Only visit the children of the bootclasspath_fragment for now.
+ commonModules = append(commonModules, name)
+
+ requiredFiles := child.(android.RequiredFilesFromPrebuiltApex).RequiredFilesFromPrebuiltApex(ctx)
+ for k, v := range requiredFiles {
+ if f, ok := exportedFilesByKey[k]; ok && f != v {
+ otherModule := requiringModulesByKey[k]
+ ctx.ModuleErrorf("inconsistent paths have been requested for key %q, %s requires path %s while %s requires path %s",
+ k, child, v, otherModule, f)
+ continue
+ }
+ exportedFilesByKey[k] = v
+ requiringModulesByKey[k] = child
+ }
+
+ // Make sure to visit the children of the bootclasspath_fragment.
return true
}
@@ -571,16 +586,16 @@
// Create properties for deapexer module.
deapexerProperties := &DeapexerProperties{
- // Remove any duplicates from the java modules lists as a module may be included via a direct
+ // Remove any duplicates from the common modules lists as a module may be included via a direct
// dependency as well as transitive ones.
- CommonModules: android.SortedUniqueStrings(javaModules),
+ CommonModules: android.SortedUniqueStrings(commonModules),
}
// Populate the exported files property in a fixed order.
- for _, tag := range android.SortedStringKeys(exportedFiles) {
+ for _, tag := range android.SortedStringKeys(exportedFilesByKey) {
deapexerProperties.ExportedFiles = append(deapexerProperties.ExportedFiles, DeapexerExportedFile{
Tag: tag,
- Path: exportedFiles[tag],
+ Path: exportedFilesByKey[tag],
})
}