Pass module to SdkMemberTypeDependencyTag.SdkMemberType

This change allows an SdkMemberTypeDependencyTag to select the
SdkMemberType to use to add a dependency based on the module.

Bug: 177892522
Test: m nothing
Change-Id: I2d6e51b615636dc7cd41da65808ef851dd8ae6ac
This commit is contained in:
Paul Duffin 2021-04-27 23:17:56 +01:00
parent 6d4de43833
commit eee466e439
3 changed files with 4 additions and 4 deletions

View File

@ -290,7 +290,7 @@ type SdkMemberTypeDependencyTag interface {
// SdkMemberType returns the SdkMemberType that will be used to automatically add the child module // SdkMemberType returns the SdkMemberType that will be used to automatically add the child module
// to the sdk. // to the sdk.
SdkMemberType() SdkMemberType SdkMemberType(child Module) SdkMemberType
// ExportMember determines whether a module added to the sdk through this tag will be exported // ExportMember determines whether a module added to the sdk through this tag will be exported
// from the sdk or not. // from the sdk or not.
@ -317,7 +317,7 @@ type sdkMemberDependencyTag struct {
export bool export bool
} }
func (t *sdkMemberDependencyTag) SdkMemberType() SdkMemberType { func (t *sdkMemberDependencyTag) SdkMemberType(_ Module) SdkMemberType {
return t.memberType return t.memberType
} }

View File

@ -63,7 +63,7 @@ func (b bootclasspathFragmentContentDependencyTag) ReplaceSourceWithPrebuilt() b
// SdkMemberType causes dependencies added with this tag to be automatically added to the sdk as if // SdkMemberType causes dependencies added with this tag to be automatically added to the sdk as if
// they were specified using java_boot_libs. // they were specified using java_boot_libs.
func (b bootclasspathFragmentContentDependencyTag) SdkMemberType() android.SdkMemberType { func (b bootclasspathFragmentContentDependencyTag) SdkMemberType(_ android.Module) android.SdkMemberType {
return javaBootLibsSdkMemberType return javaBootLibsSdkMemberType
} }

View File

@ -120,7 +120,7 @@ func (s *sdk) collectMembers(ctx android.ModuleContext) {
ctx.WalkDeps(func(child android.Module, parent android.Module) bool { ctx.WalkDeps(func(child android.Module, parent android.Module) bool {
tag := ctx.OtherModuleDependencyTag(child) tag := ctx.OtherModuleDependencyTag(child)
if memberTag, ok := tag.(android.SdkMemberTypeDependencyTag); ok { if memberTag, ok := tag.(android.SdkMemberTypeDependencyTag); ok {
memberType := memberTag.SdkMemberType() memberType := memberTag.SdkMemberType(child)
// Make sure that the resolved module is allowed in the member list property. // Make sure that the resolved module is allowed in the member list property.
if !memberType.IsInstance(child) { if !memberType.IsInstance(child) {