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

Commit 0c19b699 authored by Colin Cross's avatar Colin Cross
Browse files

Remove AnyVariantDirectlyInAnyApex

AnyVariantDirectlyInAnyApex requires modifying dependencies
(earlier variants).  It is only used in NotInPlatform to
detemrine if a module is provided by an apex, but it also checks
apex_available for //apex_available:platform, which is mostly
the same.

Bug: 372543712
Test: builds
Test: all apex tests pass
Change-Id: If0134ced7f802ca67c5ab576ffac7e04d5e150b9
parent 059af370
Loading
Loading
Loading
Loading
+3 −30
Original line number Diff line number Diff line
@@ -224,11 +224,8 @@ type ApexModule interface {
	// run.
	DirectlyInAnyApex() bool

	// NotInPlatform tells whether or not this module is included in an APEX and therefore
	// shouldn't be exposed to the platform (i.e. outside of the APEX) directly. A module is
	// considered to be included in an APEX either when there actually is an APEX that
	// explicitly has the module as its dependency or the module is not available to the
	// platform, which indicates that the module belongs to at least one or more other APEXes.
	// NotInPlatform returns true if the module is not available to the platform due to
	// apex_available being set and not containing "//apex_available:platform".
	NotInPlatform() bool

	// Tests if this module could have APEX variants. Even when a module type implements
@@ -291,14 +288,6 @@ type ApexProperties struct {
	// See ApexModule.DirectlyInAnyApex()
	DirectlyInAnyApex bool `blueprint:"mutated"`

	// AnyVariantDirectlyInAnyApex is true in the primary variant of a module if _any_ variant
	// of the module is directly in any apex. This includes host, arch, asan, etc. variants. It
	// is unused in any variant that is not the primary variant. Ideally this wouldn't be used,
	// as it incorrectly mixes arch variants if only one arch is in an apex, but a few places
	// depend on it, for example when an ASAN variant is created before the apexMutator. Call
	// this after apex.apexMutator is run.
	AnyVariantDirectlyInAnyApex bool `blueprint:"mutated"`

	// See ApexModule.NotAvailableForPlatform()
	NotAvailableForPlatform bool `blueprint:"mutated"`

@@ -428,7 +417,7 @@ func (m *ApexModuleBase) DirectlyInAnyApex() bool {

// Implements ApexModule
func (m *ApexModuleBase) NotInPlatform() bool {
	return m.ApexProperties.AnyVariantDirectlyInAnyApex || !m.AvailableFor(AvailableToPlatform)
	return !m.AvailableFor(AvailableToPlatform)
}

// Implements ApexModule
@@ -802,22 +791,6 @@ func UpdateDirectlyInAnyApex(mctx BottomUpMutatorContext, am ApexModule) {
		}
		return false
	})

	if base.ApexProperties.DirectlyInAnyApex {
		// Variants of a module are always visited sequentially in order, so it is safe to
		// write to another variant of this module. For a BottomUpMutator the
		// PrimaryModule() is visited first and FinalModule() is visited last.
		mctx.FinalModule().(ApexModule).apexModuleBase().ApexProperties.AnyVariantDirectlyInAnyApex = true
	}

	// If this is the FinalModule (last visited module) copy
	// AnyVariantDirectlyInAnyApex to all the other variants
	if mctx.IsFinalModule(am) {
		mctx.VisitAllModuleVariants(func(variant Module) {
			variant.(ApexModule).apexModuleBase().ApexProperties.AnyVariantDirectlyInAnyApex =
				base.ApexProperties.AnyVariantDirectlyInAnyApex
		})
	}
}

// ApexMembership tells how a module became part of an APEX.
+1 −1
Original line number Diff line number Diff line
@@ -656,7 +656,7 @@ func (library *libraryDecorator) compileModuleLibApiStubs(ctx ModuleContext, fla
	// However, having this distinction helps guard accidental
	// promotion or demotion of API and also helps the API review process b/191371676
	var flag string
	if ctx.Module().(android.ApexModule).NotInPlatform() {
	if ctx.notInPlatform() {
		flag = "--apex"
	} else {
		flag = "--systemapi"