Merge changes from topic "populate-bootclasspath-fragments-with-stem" into sc-dev

* changes:
  Use stem when filtering boot jars.
  Revert "Partial Revert "Populate individual classpath_fragments'..."
This commit is contained in:
Artur Satayev 2021-05-26 16:10:57 +00:00 committed by Android (Google) Code Review
commit b9d7ff160c
4 changed files with 40 additions and 11 deletions

View File

@ -1778,3 +1778,9 @@ type ProvidesUsesLib interface {
func (j *Module) ProvidesUsesLib() *string {
return j.usesLibraryProperties.Provides_uses_lib
}
type ModuleWithStem interface {
Stem() string
}
var _ ModuleWithStem = (*Module)(nil)

View File

@ -490,8 +490,27 @@ func (b *BootclasspathFragmentModule) generateClasspathProtoBuildActions(ctx and
}
func (b *BootclasspathFragmentModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
// TODO(satayev): populate with actual content
return android.EmptyConfiguredJarList()
if "art" == proptools.String(b.properties.Image_name) {
return b.getImageConfig(ctx).modules
}
global := dexpreopt.GetGlobalConfig(ctx)
// Convert content names to their appropriate stems, in case a test library is overriding an actual boot jar
var stems []string
for _, name := range b.properties.Contents {
dep := ctx.GetDirectDepWithTag(name, bootclasspathFragmentContentDepTag)
if m, ok := dep.(ModuleWithStem); ok {
stems = append(stems, m.Stem())
} else {
ctx.PropertyErrorf("contents", "%v is not a ModuleWithStem", name)
}
}
// Only create configs for updatable boot jars. Non-updatable boot jars must be part of the
// platform_bootclasspath's classpath proto config to guarantee that they come before any
// updatable jars at runtime.
return global.UpdatableBootJars.Filter(stems)
}
func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {

View File

@ -203,18 +203,11 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
func (b *platformBootclasspathModule) generateClasspathProtoBuildActions(ctx android.ModuleContext) {
// ART and platform boot jars must have a corresponding entry in DEX2OATBOOTCLASSPATH
classpathJars := configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), BOOTCLASSPATH, DEX2OATBOOTCLASSPATH)
// TODO(satayev): remove updatable boot jars once each apex has its own fragment
global := dexpreopt.GetGlobalConfig(ctx)
classpathJars = append(classpathJars, configuredJarListToClasspathJars(ctx, global.UpdatableBootJars, BOOTCLASSPATH)...)
b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, classpathJars)
}
func (b *platformBootclasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
global := dexpreopt.GetGlobalConfig(ctx)
// TODO(satayev): split ART apex jars into their own classpathFragment
return global.BootJars
return b.getImageConfig(ctx).modules
}
// checkNonUpdatableModules ensures that the non-updatable modules supplied are not part of an

View File

@ -97,10 +97,21 @@ func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.Mo
func (s *SystemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
global := dexpreopt.GetGlobalConfig(ctx)
// Convert content names to their appropriate stems, in case a test library is overriding an actual boot jar
var stems []string
for _, name := range s.properties.Contents {
dep := ctx.GetDirectDepWithTag(name, systemServerClasspathFragmentContentDepTag)
if m, ok := dep.(ModuleWithStem); ok {
stems = append(stems, m.Stem())
} else {
ctx.PropertyErrorf("contents", "%v is not a ModuleWithStem", name)
}
}
// Only create configs for updatable boot jars. Non-updatable system server jars must be part of the
// platform_systemserverclasspath's classpath proto config to guarantee that they come before any
// updatable jars at runtime.
return global.UpdatableSystemServerJars.Filter(s.properties.Contents)
return global.UpdatableSystemServerJars.Filter(stems)
}
type systemServerClasspathFragmentContentDependencyTag struct {