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

Commit 578b5f06 authored by Joanne Chung's avatar Joanne Chung Committed by Gerrit Code Review
Browse files

Merge "Revert "Make ConfiguredJarList immutable""

parents bb0e7034 1f25794e
Loading
Loading
Loading
Loading
+18 −20
Original line number Diff line number Diff line
@@ -1362,22 +1362,13 @@ func (l *ConfiguredJarList) IndexOfJar(jar string) int {
}

// Append an (apex, jar) pair to the list.
func (l *ConfiguredJarList) Append(apex string, jar string) ConfiguredJarList {
	// Create a copy of the backing arrays before appending to avoid sharing backing
	// arrays that are mutated across instances.
	apexes := make([]string, 0, len(l.apexes)+1)
	copy(apexes, l.apexes)
	apexes = append(apexes, apex)

	jars := make([]string, 0, len(l.jars)+1)
	copy(jars, l.jars)
	jars = append(l.jars, jar)

	return ConfiguredJarList{apexes, jars}
func (l *ConfiguredJarList) Append(apex string, jar string) {
	l.apexes = append(l.apexes, apex)
	l.jars = append(l.jars, jar)
}

// Filter out sublist.
func (l *ConfiguredJarList) RemoveList(list ConfiguredJarList) ConfiguredJarList {
func (l *ConfiguredJarList) RemoveList(list ConfiguredJarList) {
	apexes := make([]string, 0, l.Len())
	jars := make([]string, 0, l.Len())

@@ -1389,7 +1380,13 @@ func (l *ConfiguredJarList) RemoveList(list ConfiguredJarList) ConfiguredJarList
		}
	}

	return ConfiguredJarList{apexes, jars}
	l.apexes = apexes
	l.jars = jars
}

// A copy of itself.
func (l *ConfiguredJarList) CopyOf() ConfiguredJarList {
	return ConfiguredJarList{CopyOf(l.apexes), CopyOf(l.jars)}
}

// A copy of the list of strings containing jar components.
@@ -1464,16 +1461,17 @@ func splitConfiguredJarPair(ctx PathContext, str string) (string, string) {
}

func CreateConfiguredJarList(ctx PathContext, list []string) ConfiguredJarList {
	apexes := make([]string, len(list))
	jars := make([]string, len(list))
	apexes := make([]string, 0, len(list))
	jars := make([]string, 0, len(list))

	l := ConfiguredJarList{apexes, jars}

	for i, apexjar := range list {
	for _, apexjar := range list {
		apex, jar := splitConfiguredJarPair(ctx, apexjar)
		apexes[i] = apex
		jars[i] = jar
		l.Append(apex, jar)
	}

	return ConfiguredJarList{apexes, jars}
	return l
}

func EmptyConfiguredJarList() ConfiguredJarList {
+4 −3
Original line number Diff line number Diff line
@@ -81,12 +81,13 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
		targets := dexpreoptTargets(ctx)
		deviceDir := android.PathForOutput(ctx, ctx.Config().DeviceName())

		artModules := global.ArtApexJars
		artModules := global.ArtApexJars.CopyOf()
		// With EMMA_INSTRUMENT_FRAMEWORK=true the Core libraries depend on jacoco.
		if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {
			artModules = artModules.Append("com.android.art", "jacocoagent")
			artModules.Append("com.android.art", "jacocoagent")
		}
		frameworkModules := global.BootJars.RemoveList(artModules)
		frameworkModules := global.BootJars.CopyOf()
		frameworkModules.RemoveList(artModules)

		artSubdir := "apex/art_boot_images/javalib"
		frameworkSubdir := "system/framework"