Make all SdkMemberTypes support transitive member deps

Previously, only those SdkMemberTypes which had specific need to
automatically add some of their dependencies as sdk members would cause
the sdk to visit their transitive dependencies. However, as any module
can have dependencies on license modules and license modules need to be
included in the sdk then it needs to visit transitive dependencies of
all members.

So, this change removes the support for allowing an SdkMemberType to
control whether its transitive dependencies are visited and just visits
them all.

This does not have any effect on sdk snapshots as in order for a
dependency to be added to an sdk it needs to be added with a tag that
implements SdkMemberTypeDependencyTag and the only tags that implement
this are used by SdkMemberTypes that had enabled transitive members.

Bug: 181569894
Test: m art-module-sdk art-module-host-exports art-module-test-exports
      - verify that this change has no effect on the generated snapshots
Change-Id: If0293af0237aa7e39335e5b8383a41c023ff5853
This commit is contained in:
Paul Duffin
2021-05-06 12:02:27 +01:00
parent b9e7a3ca7a
commit 2d3da31d41
4 changed files with 11 additions and 27 deletions

View File

@@ -302,9 +302,7 @@ type SdkMember interface {
} }
// SdkMemberTypeDependencyTag is the interface that a tag must implement in order to allow the // SdkMemberTypeDependencyTag is the interface that a tag must implement in order to allow the
// dependent module to be automatically added to the sdk. In order for this to work the // dependent module to be automatically added to the sdk.
// SdkMemberType of the depending module must return true from
// SdkMemberType.HasTransitiveSdkMembers.
type SdkMemberTypeDependencyTag interface { type SdkMemberTypeDependencyTag interface {
blueprint.DependencyTag blueprint.DependencyTag
@@ -385,13 +383,6 @@ type SdkMemberType interface {
// True if the member type supports the sdk/sdk_snapshot, false otherwise. // True if the member type supports the sdk/sdk_snapshot, false otherwise.
UsableWithSdkAndSdkSnapshot() bool UsableWithSdkAndSdkSnapshot() bool
// Return true if modules of this type can have dependencies which should be
// treated as if they are sdk members.
//
// Any dependency that is to be treated as a member of the sdk needs to implement
// SdkAware and be added with an SdkMemberTypeDependencyTag tag.
HasTransitiveSdkMembers() bool
// Return true if prebuilt host artifacts may be specific to the host OS. Only // Return true if prebuilt host artifacts may be specific to the host OS. Only
// applicable to modules where HostSupported() is true. If this is true, // applicable to modules where HostSupported() is true. If this is true,
// snapshots will list each host OS variant explicitly and disable all other // snapshots will list each host OS variant explicitly and disable all other
@@ -457,10 +448,9 @@ type SdkMemberType interface {
// Base type for SdkMemberType implementations. // Base type for SdkMemberType implementations.
type SdkMemberTypeBase struct { type SdkMemberTypeBase struct {
PropertyName string PropertyName string
SupportsSdk bool SupportsSdk bool
TransitiveSdkMembers bool HostOsDependent bool
HostOsDependent bool
} }
func (b *SdkMemberTypeBase) SdkPropertyName() string { func (b *SdkMemberTypeBase) SdkPropertyName() string {
@@ -471,10 +461,6 @@ func (b *SdkMemberTypeBase) UsableWithSdkAndSdkSnapshot() bool {
return b.SupportsSdk return b.SupportsSdk
} }
func (b *SdkMemberTypeBase) HasTransitiveSdkMembers() bool {
return b.TransitiveSdkMembers
}
func (b *SdkMemberTypeBase) IsHostOsDependent() bool { func (b *SdkMemberTypeBase) IsHostOsDependent() bool {
return b.HostOsDependent return b.HostOsDependent
} }

View File

@@ -32,9 +32,8 @@ func init() {
android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{ android.RegisterSdkMemberType(&bootclasspathFragmentMemberType{
SdkMemberTypeBase: android.SdkMemberTypeBase{ SdkMemberTypeBase: android.SdkMemberTypeBase{
PropertyName: "bootclasspath_fragments", PropertyName: "bootclasspath_fragments",
SupportsSdk: true, SupportsSdk: true,
TransitiveSdkMembers: true,
}, },
}) })
} }

View File

@@ -35,9 +35,8 @@ func init() {
// Register sdk member types. // Register sdk member types.
android.RegisterSdkMemberType(&systemModulesSdkMemberType{ android.RegisterSdkMemberType(&systemModulesSdkMemberType{
android.SdkMemberTypeBase{ android.SdkMemberTypeBase{
PropertyName: "java_system_modules", PropertyName: "java_system_modules",
SupportsSdk: true, SupportsSdk: true,
TransitiveSdkMembers: true,
}, },
}) })
} }

View File

@@ -133,9 +133,9 @@ func (s *sdk) collectMembers(ctx android.ModuleContext) {
export := memberTag.ExportMember() export := memberTag.ExportMember()
s.memberVariantDeps = append(s.memberVariantDeps, sdkMemberVariantDep{s, memberType, child.(android.SdkAware), export}) s.memberVariantDeps = append(s.memberVariantDeps, sdkMemberVariantDep{s, memberType, child.(android.SdkAware), export})
// If the member type supports transitive sdk members then recurse down into // Recurse down into the member's dependencies as it may have dependencies that need to be
// its dependencies, otherwise exit traversal. // automatically added to the sdk.
return memberType.HasTransitiveSdkMembers() return true
} }
return false return false