Add support for transitive sdk members

Allow an sdk member type to treat some of its dependencies as being
members of the sdk.

Needed for the java_system_modules type whose libs property are an
implementation detail of the system module and so should not be
explicitly listed in the sdk module but still have to be included in
the sdk snapshot.

Bug: 142940300
Test: m nothing
Change-Id: I90f37dae269ef64a6fe9debd0bbaf29a64dd74d8
This commit is contained in:
Paul Duffin
2020-01-13 20:58:25 +00:00
parent f3c9d74cfa
commit f4ae4f1390
2 changed files with 28 additions and 10 deletions

View File

@@ -264,6 +264,13 @@ type SdkMemberType interface {
// True if the member type supports the sdk/sdk_snapshot, false otherwise.
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
// Add dependencies from the SDK module to all the variants the member
// contributes to the SDK. The exact set of variants required is determined
// by the SDK and its properties. The dependencies must be added with the
@@ -291,8 +298,9 @@ type SdkMemberType interface {
// Base type for SdkMemberType implementations.
type SdkMemberTypeBase struct {
PropertyName string
SupportsSdk bool
PropertyName string
SupportsSdk bool
TransitiveSdkMembers bool
}
func (b *SdkMemberTypeBase) SdkPropertyName() string {
@@ -303,6 +311,10 @@ func (b *SdkMemberTypeBase) UsableWithSdkAndSdkSnapshot() bool {
return b.SupportsSdk
}
func (b *SdkMemberTypeBase) HasTransitiveSdkMembers() bool {
return b.TransitiveSdkMembers
}
// Encapsulates the information about registered SdkMemberTypes.
type SdkMemberTypesRegistry struct {
// The list of types sorted by property name.