浏览代码

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
Paul Duffin 1 年之前
父节点
当前提交
5e71e68a82
共有 2 个文件被更改,包括 15 次插入15 次删除
  1. 2 2
      android/sdk.go
  2. 13 13
      sdk/update.go

+ 2 - 2
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

+ 13 - 13
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)