Copy white listed apex available settings into snapshot

Makes sure that the module snapshots do not rely on the white list
of apex available settings so that when those lists are removed it is
not necessary to update any snapshots.

Bug: 142935992
Test: m nothing
Change-Id: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
This commit is contained in:
Paul Duffin
2020-03-06 12:30:13 +00:00
parent 0cb37b9ce1
commit 7d74e7bea3
3 changed files with 47 additions and 15 deletions

View File

@@ -20,6 +20,7 @@ import (
"sort"
"strings"
"android/soong/apex"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -640,7 +641,15 @@ func (s *snapshotBuilder) AddPrebuiltModule(member android.SdkMember, moduleType
// Where available copy apex_available properties from the member.
if apexAware, ok := variant.(interface{ ApexAvailable() []string }); ok {
apexAvailable := apexAware.ApexAvailable()
// Add in any white listed apex available settings.
apexAvailable = append(apexAvailable, apex.WhitelistedApexAvailable(member.Name())...)
if len(apexAvailable) > 0 {
// Remove duplicates and sort.
apexAvailable = android.FirstUniqueStrings(apexAvailable)
sort.Strings(apexAvailable)
m.AddProperty("apex_available", apexAvailable)
}
}