Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9d7ff16 authored by Artur Satayev's avatar Artur Satayev Committed by Android (Google) Code Review
Browse files

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'..."
parents 119770fd 07753d84
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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)
+21 −2
Original line number Diff line number Diff line
@@ -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 {
+1 −8
Original line number Diff line number Diff line
@@ -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
+12 −1
Original line number Diff line number Diff line
@@ -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 {