Make copyBootJarsToPredefinedLocations simpler and less fragile
Previously, copyBootJarsToPredefinedLocations relied on all its parameters having the same length and the same order. That made it quite fragile as changes to one of the parameters without corresponding changes to the other would cause failures. It also combined the retrieval of the boot dex jars from the modules, handling of missing boot dex jar files and the generation of the rules to copy the files. This change separates the retrieval of boot dex jars and handling of missing files from the copying of those files while at the same time making the function less fragile by replacing the three ordered parameters with two maps that shared common keys. Bug: 179354495 Test: m nothing Change-Id: Idbcd24a7e8af89f7895a20aeddc58502dcbaad03
This commit is contained in:
@@ -100,6 +100,7 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
|
||||
// TODO(b/143682396): use module dependencies instead
|
||||
inputDir := deviceDir.Join(ctx, "dex_"+c.name+"jars_input")
|
||||
c.dexPaths = c.modules.BuildPaths(ctx, inputDir)
|
||||
c.dexPathsByModule = c.modules.BuildPathsByModule(ctx, inputDir)
|
||||
c.dexPathsDeps = c.dexPaths
|
||||
|
||||
// Create target-specific variants.
|
||||
@@ -153,6 +154,9 @@ type updatableBootConfig struct {
|
||||
// later on a singleton adds commands to copy actual jars to the predefined paths.
|
||||
dexPaths android.WritablePaths
|
||||
|
||||
// Map from module name (without prebuilt_ prefix) to the predefined build path.
|
||||
dexPathsByModule map[string]android.WritablePath
|
||||
|
||||
// A list of dex locations (a.k.a. on-device paths) to the boot jars.
|
||||
dexLocations []string
|
||||
}
|
||||
@@ -166,10 +170,11 @@ func GetUpdatableBootConfig(ctx android.PathContext) updatableBootConfig {
|
||||
|
||||
dir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "updatable_bootjars")
|
||||
dexPaths := updatableBootJars.BuildPaths(ctx, dir)
|
||||
dexPathsByModuleName := updatableBootJars.BuildPathsByModule(ctx, dir)
|
||||
|
||||
dexLocations := updatableBootJars.DevicePaths(ctx.Config(), android.Android)
|
||||
|
||||
return updatableBootConfig{updatableBootJars, dexPaths, dexLocations}
|
||||
return updatableBootConfig{updatableBootJars, dexPaths, dexPathsByModuleName, dexLocations}
|
||||
}).(updatableBootConfig)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user