Move copying of dex files from dexpreopt_bootjars singleton

The art dex files are copied in the bootclasspath_fragment and the
non-updatable and updatable dex files are copied in the
platform_bootclasspath.

Bug: 177892522
Test: m nothing
Change-Id: I5d3d533d1a7a9f8e7ae20c12eb33029a898a2cd6
This commit is contained in:
Paul Duffin
2021-04-27 19:36:57 +01:00
parent c8aeb00a9c
commit 7ebebfd5f8
5 changed files with 64 additions and 83 deletions

View File

@@ -361,6 +361,15 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo
// Generate classpaths.proto config
b.generateClasspathProtoBuildActions(ctx)
// Gather the bootclasspath fragment's contents.
var contents []android.Module
ctx.VisitDirectDeps(func(module android.Module) {
tag := ctx.OtherModuleDependencyTag(module)
if IsBootclasspathFragmentContentDepTag(tag) {
contents = append(contents, module)
}
})
// Perform hidden API processing.
b.generateHiddenAPIBuildActions(ctx)
@@ -376,6 +385,9 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo
// GenerateSingletonBuildActions method as it cannot create it for itself.
dexpreopt.GetGlobalSoongConfig(ctx)
info.imageConfig = b.getImageConfig(ctx)
// Only generate the boot image if the configuration does not skip it.
b.generateBootImageBuildActions(ctx, contents)
}
// Make it available for other modules.
@@ -434,6 +446,40 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
ctx.SetProvider(bootclasspathApiInfoProvider, bootclasspathApiInfo)
}
// generateBootImageBuildActions generates ninja rules to create the boot image if required for this
// module.
func (b *BootclasspathFragmentModule) generateBootImageBuildActions(ctx android.ModuleContext, contents []android.Module) {
global := dexpreopt.GetGlobalConfig(ctx)
if !shouldBuildBootImages(ctx.Config(), global) {
return
}
// Bootclasspath fragment modules that are not preferred do not produce a boot image.
if !isActiveModule(ctx.Module()) {
return
}
// Bootclasspath fragment modules that have no image_name property do not produce a boot image.
imageConfig := b.getImageConfig(ctx)
if imageConfig == nil {
return
}
// Bootclasspath fragment modules that are for the platform do not produce a boot image.
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
if apexInfo.IsForPlatform() {
return
}
// Bootclasspath fragment modules that are versioned do not produce a boot image.
if android.IsModuleInVersionedSdk(ctx.Module()) {
return
}
// Copy the dex jars of this fragment's content modules to their predefined locations.
copyBootJarsToPredefinedLocations(ctx, contents, imageConfig.modules, imageConfig.dexPaths)
}
type bootclasspathFragmentMemberType struct {
android.SdkMemberTypeBase
}