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
diff --git a/android/apex.go b/android/apex.go index fb2ad6c..db93912 100644 --- a/android/apex.go +++ b/android/apex.go
@@ -252,9 +252,6 @@ // 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 @@ // 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 @@ 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
diff --git a/cc/cc.go b/cc/cc.go index bd91964..2f54c5c 100644 --- a/cc/cc.go +++ b/cc/cc.go
@@ -1880,7 +1880,7 @@ // 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