Merge "Differentiate between art, non-updatable and updatable modules"

This commit is contained in:
Paul Duffin
2021-04-29 12:20:06 +00:00
committed by Gerrit Code Review

View File

@@ -29,8 +29,13 @@ func registerPlatformBootclasspathBuildComponents(ctx android.RegistrationContex
ctx.RegisterModuleType("platform_bootclasspath", platformBootclasspathFactory) ctx.RegisterModuleType("platform_bootclasspath", platformBootclasspathFactory)
} }
// The tag used for the dependency between the platform bootclasspath and any configured boot jars. // The tags used for the dependencies between the platform bootclasspath and any configured boot
var platformBootclasspathModuleDepTag = bootclasspathDependencyTag{name: "module"} // jars.
var (
platformBootclasspathArtBootJarDepTag = bootclasspathDependencyTag{name: "art-boot-jar"}
platformBootclasspathNonUpdatableBootJarDepTag = bootclasspathDependencyTag{name: "non-updatable-boot-jar"}
platformBootclasspathUpdatableBootJarDepTag = bootclasspathDependencyTag{name: "updatable-boot-jar"}
)
type platformBootclasspathModule struct { type platformBootclasspathModule struct {
android.ModuleBase android.ModuleBase
@@ -125,34 +130,46 @@ func (b *platformBootclasspathModule) hiddenAPIDepsMutator(ctx android.BottomUpM
func (b *platformBootclasspathModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) { func (b *platformBootclasspathModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {
// Add dependencies on all the modules configured in the "art" boot image. // Add dependencies on all the modules configured in the "art" boot image.
artImageConfig := genBootImageConfigs(ctx)[artBootImageName] artImageConfig := genBootImageConfigs(ctx)[artBootImageName]
addDependenciesOntoBootImageModules(ctx, artImageConfig.modules) addDependenciesOntoBootImageModules(ctx, artImageConfig.modules, platformBootclasspathArtBootJarDepTag)
// Add dependencies on all the modules configured in the "boot" boot image. That does not // Add dependencies on all the non-updatable module configured in the "boot" boot image. That does
// include modules configured in the "art" boot image. // not include modules configured in the "art" boot image.
bootImageConfig := b.getImageConfig(ctx) bootImageConfig := b.getImageConfig(ctx)
addDependenciesOntoBootImageModules(ctx, bootImageConfig.modules) addDependenciesOntoBootImageModules(ctx, bootImageConfig.modules, platformBootclasspathNonUpdatableBootJarDepTag)
// Add dependencies on all the updatable modules. // Add dependencies on all the updatable modules.
updatableModules := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars updatableModules := dexpreopt.GetGlobalConfig(ctx).UpdatableBootJars
addDependenciesOntoBootImageModules(ctx, updatableModules) addDependenciesOntoBootImageModules(ctx, updatableModules, platformBootclasspathUpdatableBootJarDepTag)
// Add dependencies on all the fragments. // Add dependencies on all the fragments.
b.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx) b.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx)
} }
func addDependenciesOntoBootImageModules(ctx android.BottomUpMutatorContext, modules android.ConfiguredJarList) { func addDependenciesOntoBootImageModules(ctx android.BottomUpMutatorContext, modules android.ConfiguredJarList, tag bootclasspathDependencyTag) {
for i := 0; i < modules.Len(); i++ { for i := 0; i < modules.Len(); i++ {
apex := modules.Apex(i) apex := modules.Apex(i)
name := modules.Jar(i) name := modules.Jar(i)
addDependencyOntoApexModulePair(ctx, apex, name, platformBootclasspathModuleDepTag) addDependencyOntoApexModulePair(ctx, apex, name, tag)
} }
} }
func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
b.classpathFragmentBase().generateAndroidBuildActions(ctx) b.classpathFragmentBase().generateAndroidBuildActions(ctx)
b.configuredModules = gatherApexModulePairDepsWithTag(ctx, platformBootclasspathModuleDepTag) // Gather all the dependencies from the art, updatable and non-updatable boot jars.
artModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathArtBootJarDepTag)
nonUpdatableModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathNonUpdatableBootJarDepTag)
updatableModules := gatherApexModulePairDepsWithTag(ctx, platformBootclasspathUpdatableBootJarDepTag)
// Concatenate them all, in order as they would appear on the bootclasspath.
var allModules []android.Module
allModules = append(allModules, artModules...)
allModules = append(allModules, nonUpdatableModules...)
allModules = append(allModules, updatableModules...)
b.configuredModules = allModules
// Gather all the fragments dependencies.
b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag) b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments) b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)