summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2022-11-23 18:09:54 +0000
committer Paul Duffin <paulduffin@google.com> 2022-12-12 17:33:06 +0000
commit5e71e68a82bf00b8d1ddb3c6d50a0aa38458530c (patch)
tree5d40b7037637172e1118e96375ae81dc15c5fc34
parent2178762a8aa11aee7705723b12e98c3cead8204e (diff)
Replace usages of SdkAware in sdk module with Module
Previously, the sdk snapshot code used SdkAware instead of Module to ensure that all its members had implemented SdkAware. However, it never used any of the methods provided by SdkAware, or if it did it no longer does. So, this change replaces usages of SdkAware with Module in preparation for deleting it completely. Bug: 260237150 Test: m nothing Change-Id: Ia89e02394f27b2da776f0cf0f0bc86835a03433a
-rw-r--r--android/sdk.go4
-rw-r--r--sdk/update.go26
2 files changed, 15 insertions, 15 deletions
diff --git a/android/sdk.go b/android/sdk.go
index b94217dfe..063091e86 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -541,7 +541,7 @@ type SdkMember interface {
Name() string
// Variants returns all the variants of this module depended upon by the SDK.
- Variants() []SdkAware
+ Variants() []Module
}
// SdkMemberDependencyTag is the interface that a tag must implement in order to allow the
@@ -673,7 +673,7 @@ type SdkMemberType interface {
// The sdk module code generates the snapshot as follows:
//
// * A properties struct of type SdkMemberProperties is created for each variant and
- // populated with information from the variant by calling PopulateFromVariant(SdkAware)
+ // populated with information from the variant by calling PopulateFromVariant(Module)
// on the struct.
//
// * An additional properties struct is created into which the common properties will be
diff --git a/sdk/update.go b/sdk/update.go
index baa203302..f50439c3e 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -171,9 +171,9 @@ func (s *sdk) collectMembers(ctx android.ModuleContext) {
exportedComponentsInfo = ctx.OtherModuleProvider(child, android.ExportedComponentsInfoProvider).(android.ExportedComponentsInfo)
}
- var container android.SdkAware
+ var container android.Module
if parent != ctx.Module() {
- container = parent.(android.SdkAware)
+ container = parent.(android.Module)
}
minApiLevel := android.MinApiLevelForSdkSnapshot(ctx, child)
@@ -182,7 +182,7 @@ func (s *sdk) collectMembers(ctx android.ModuleContext) {
s.memberVariantDeps = append(s.memberVariantDeps, sdkMemberVariantDep{
sdkVariant: s,
memberType: memberType,
- variant: child.(android.SdkAware),
+ variant: child.(android.Module),
minApiLevel: minApiLevel,
container: container,
export: export,
@@ -269,7 +269,7 @@ func isMemberTypeSupportedByTargetBuildRelease(memberType android.SdkMemberType,
return supportedByTargetBuildRelease
}
-func appendUniqueVariants(variants []android.SdkAware, newVariant android.SdkAware) []android.SdkAware {
+func appendUniqueVariants(variants []android.Module, newVariant android.Module) []android.Module {
for _, v := range variants {
if v == newVariant {
return variants
@@ -1246,12 +1246,12 @@ type sdkMemberVariantDep struct {
memberType android.SdkMemberType
// The variant that is added to the sdk.
- variant android.SdkAware
+ variant android.Module
// The optional container of this member, i.e. the module that is depended upon by the sdk
// (possibly transitively) and whose dependency on this module is why it was added to the sdk.
// Is nil if this a direct dependency of the sdk.
- container android.SdkAware
+ container android.Module
// True if the member should be exported, i.e. accessible, from outside the sdk.
export bool
@@ -1270,14 +1270,14 @@ var _ android.SdkMember = (*sdkMember)(nil)
type sdkMember struct {
memberType android.SdkMemberType
name string
- variants []android.SdkAware
+ variants []android.Module
}
func (m *sdkMember) Name() string {
return m.name
}
-func (m *sdkMember) Variants() []android.SdkAware {
+func (m *sdkMember) Variants() []android.Module {
return m.variants
}
@@ -1362,24 +1362,24 @@ func getVariantCoordinate(ctx *memberContext, variant android.Module) variantCoo
// by apex variant, where one is the default/platform variant and one is the APEX variant. In that
// case it picks the APEX variant. It picks the APEX variant because that is the behavior that would
// be expected
-func selectApexVariantsWhereAvailable(ctx *memberContext, variants []android.SdkAware) []android.SdkAware {
+func selectApexVariantsWhereAvailable(ctx *memberContext, variants []android.Module) []android.Module {
moduleCtx := ctx.sdkMemberContext
// Group the variants by coordinates.
- variantsByCoord := make(map[variantCoordinate][]android.SdkAware)
+ variantsByCoord := make(map[variantCoordinate][]android.Module)
for _, variant := range variants {
coord := getVariantCoordinate(ctx, variant)
variantsByCoord[coord] = append(variantsByCoord[coord], variant)
}
- toDiscard := make(map[android.SdkAware]struct{})
+ toDiscard := make(map[android.Module]struct{})
for coord, list := range variantsByCoord {
count := len(list)
if count == 1 {
continue
}
- variantsByApex := make(map[string]android.SdkAware)
+ variantsByApex := make(map[string]android.Module)
conflictDetected := false
for _, variant := range list {
apexInfo := moduleCtx.OtherModuleProvider(variant, android.ApexInfoProvider).(android.ApexInfo)
@@ -1421,7 +1421,7 @@ func selectApexVariantsWhereAvailable(ctx *memberContext, variants []android.Sdk
// If there are any variants to discard then remove them from the list of variants, while
// preserving the order.
if len(toDiscard) > 0 {
- filtered := []android.SdkAware{}
+ filtered := []android.Module{}
for _, variant := range variants {
if _, ok := toDiscard[variant]; !ok {
filtered = append(filtered, variant)