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

Commit 110b0add authored by Paul Duffin's avatar Paul Duffin
Browse files

Treat "apex" system_ext the same as platform

Change https://r.android.com/1672245 added support to treat
system_ext:foo in the boot jars configuration the same as platform:foo,
at least for dexpreopt_bootjars.go's getBootJar.

This change replicates that mechanism in platform_bootclasspath and as
that now handles hidden API processing also made a similar change in
the isModuleInConfiguredList function.

Bug: 177892522
Bug: 154976937
Test: m nothing
Change-Id: I105f4fbaa3b0355b013b7c5618d218d888faefb6
parent 50599f77
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -69,13 +69,13 @@ func addDependencyOntoApexVariants(ctx android.BottomUpMutatorContext, propertyN
// addDependencyOntoApexModulePair adds a dependency onto the specified APEX specific variant or the
// specified module.
//
// If apex="platform" then this adds a dependency onto the platform variant of the module. This adds
// dependencies onto the prebuilt and source modules with the specified name, depending on which
// ones are available. Visiting must use isActiveModule to select the preferred module when both
// source and prebuilt modules are available.
// If apex="platform" or "system_ext" then this adds a dependency onto the platform variant of the
// module. This adds dependencies onto the prebuilt and source modules with the specified name,
// depending on which ones are available. Visiting must use isActiveModule to select the preferred
// module when both source and prebuilt modules are available.
func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex string, name string, tag blueprint.DependencyTag) {
	var variations []blueprint.Variation
	if apex != "platform" {
	if apex != "platform" && apex != "system_ext" {
		// Pick the correct apex variant.
		variations = []blueprint.Variation{
			{Mutator: "apex", Variation: apex},
@@ -124,6 +124,9 @@ type ApexVariantReference struct {
	//
	// If this is not specified then it defaults to "platform" which will cause a dependency to be
	// added to the module's platform variant.
	//
	// A value of system_ext should be used for any module that will be part of the system_ext
	// partition.
	Apex *string

	// The name of the module.
+1 −1
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ func isModuleInConfiguredList(ctx android.BaseModuleContext, module android.Modu

	// Now match the apex part of the boot image configuration.
	requiredApex := configuredBootJars.Apex(index)
	if requiredApex == "platform" {
	if requiredApex == "platform" || requiredApex == "system_ext" {
		if len(apexInfo.InApexes) != 0 {
			// A platform variant is required but this is for an apex so ignore it.
			return false
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ var prepareForTestWithPlatformBootclasspath = android.GroupFixturePreparers(
func TestPlatformBootclasspath(t *testing.T) {
	preparer := android.GroupFixturePreparers(
		prepareForTestWithPlatformBootclasspath,
		FixtureConfigureBootJars("platform:foo", "platform:bar"),
		FixtureConfigureBootJars("platform:foo", "system_ext:bar"),
		android.FixtureWithRootAndroidBp(`
			platform_bootclasspath {
				name: "platform-bootclasspath",
@@ -45,6 +45,7 @@ func TestPlatformBootclasspath(t *testing.T) {
				system_modules: "none",
				sdk_version: "none",
				compile_dex: true,
				system_ext_specific: true,
			}
		`),
	)