diff --git a/android/sdk.go b/android/sdk.go index 006b3a01e..27756ce66 100644 --- a/android/sdk.go +++ b/android/sdk.go @@ -218,6 +218,25 @@ type SdkMember interface { Variants() []SdkAware } +type SdkMemberTypeDependencyTag interface { + blueprint.DependencyTag + + SdkMemberType() SdkMemberType +} + +type sdkMemberDependencyTag struct { + blueprint.BaseDependencyTag + memberType SdkMemberType +} + +func (t *sdkMemberDependencyTag) SdkMemberType() SdkMemberType { + return t.memberType +} + +func DependencyTagForSdkMemberType(memberType SdkMemberType) SdkMemberTypeDependencyTag { + return &sdkMemberDependencyTag{memberType: memberType} +} + // Interface that must be implemented for every type that can be a member of an // sdk. // diff --git a/sdk/sdk.go b/sdk/sdk.go index 3b0752ff7..f22763c10 100644 --- a/sdk/sdk.go +++ b/sdk/sdk.go @@ -65,11 +65,6 @@ type sdkProperties struct { Module_exports bool `blueprint:"mutated"` } -type sdkMemberDependencyTag struct { - blueprint.BaseDependencyTag - memberType android.SdkMemberType -} - // Contains information about the sdk properties that list sdk members, e.g. // Java_header_libs. type sdkMemberListProperty struct { @@ -81,7 +76,7 @@ type sdkMemberListProperty struct { // the dependency tag used for items in this list that can be used to determine the memberType // for a resolved dependency. - dependencyTag *sdkMemberDependencyTag + dependencyTag android.SdkMemberTypeDependencyTag } func (p *sdkMemberListProperty) propertyName() string { @@ -167,9 +162,7 @@ func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynami memberType: memberType, - dependencyTag: &sdkMemberDependencyTag{ - memberType: memberType, - }, + dependencyTag: android.DependencyTagForSdkMemberType(memberType), } listProperties = append(listProperties, memberListProperty) diff --git a/sdk/update.go b/sdk/update.go index 0d2e4e44e..97bafa1ba 100644 --- a/sdk/update.go +++ b/sdk/update.go @@ -113,8 +113,8 @@ func (s *sdk) collectMembers(ctx android.ModuleContext) []*sdkMember { ctx.VisitDirectDeps(func(m android.Module) { tag := ctx.OtherModuleDependencyTag(m) - if memberTag, ok := tag.(*sdkMemberDependencyTag); ok { - memberType := memberTag.memberType + if memberTag, ok := tag.(android.SdkMemberTypeDependencyTag); ok { + memberType := memberTag.SdkMemberType() // Make sure that the resolved module is allowed in the member list property. if !memberType.IsInstance(m) {