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

Commit 2dcbca69 authored by Colin Cross's avatar Colin Cross
Browse files

Replace InAnyApex with checking apex_available

The InAnyApex property is set by the apex transition mutator when
any apex variants are being created.  This is effectively communicating
the existence of the apex variant to the platform variant, which
complicates incremental analysis by making the platform variant
implicitly depend on the apex variant.

Replace the InAnyApex property with checking if apex_available has any
entries that are not "//apex_available:platform".

Bug: 372543712
Test: all soong tests pass
Change-Id: I2e0ae467cec0ee683ed4815a2b7397ef41375de2
parent cdeb7bbd
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -252,9 +252,6 @@ type ApexProperties struct {
	// Default is ["//apex_available:platform"].
	Apex_available []string

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

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

@@ -351,7 +348,12 @@ func (m *ApexModuleBase) BuildForApex(apex ApexInfo) {

// Implements ApexModule
func (m *ApexModuleBase) InAnyApex() bool {
	return m.ApexProperties.InAnyApex
	for _, apex_name := range m.ApexProperties.Apex_available {
		if apex_name != AvailableToPlatform {
			return true
		}
	}
	return false
}

// Implements ApexModule
@@ -609,8 +611,6 @@ func MutateApexTransition(ctx BaseModuleContext, variation string) {
		apexInfos, _ = mergeApexVariations(apexInfos)
	}

	base.ApexProperties.InAnyApex = true

	if platformVariation && !ctx.Host() && !module.AvailableFor(AvailableToPlatform) && module.NotAvailableForPlatform() {
		// Do not install the module for platform, but still allow it to output
		// uninstallable AndroidMk entries in certain cases when they have side
+1 −1
Original line number Diff line number Diff line
@@ -1880,7 +1880,7 @@ var (
// Returns true if a stub library could be installed in multiple apexes
func (c *Module) stubLibraryMultipleApexViolation(ctx android.ModuleContext) bool {
	// If this is not an apex variant, no check necessary
	if !c.InAnyApex() {
	if info, ok := android.ModuleProvider(ctx, android.ApexInfoProvider); !ok || info.IsForPlatform() {
		return false
	}
	// If this is not a stub library, no check necessary