Allow an sdk member type not to provide a bp property

Bug: 181569894
Test: m nothing
Change-Id: I7e98f14cb377683457fba32fd05d6c614f78ffeb
This commit is contained in:
Paul Duffin
2021-05-11 00:31:38 +01:00
parent 0d4ed0ac56
commit 1308205638
3 changed files with 52 additions and 20 deletions

View File

@@ -380,6 +380,10 @@ type SdkMemberType interface {
// The name of the member type property on an sdk module.
SdkPropertyName() string
// RequiresBpProperty returns true if this member type requires its property to be usable within
// an Android.bp file.
RequiresBpProperty() bool
// True if the member type supports the sdk/sdk_snapshot, false otherwise.
UsableWithSdkAndSdkSnapshot() bool
@@ -452,7 +456,12 @@ type SdkMemberType interface {
// Base type for SdkMemberType implementations.
type SdkMemberTypeBase struct {
PropertyName string
PropertyName string
// When set to true BpPropertyNotRequired indicates that the member type does not require the
// property to be specifiable in an Android.bp file.
BpPropertyNotRequired bool
SupportsSdk bool
HostOsDependent bool
@@ -466,6 +475,10 @@ func (b *SdkMemberTypeBase) SdkPropertyName() string {
return b.PropertyName
}
func (b *SdkMemberTypeBase) RequiresBpProperty() bool {
return !b.BpPropertyNotRequired
}
func (b *SdkMemberTypeBase) UsableWithSdkAndSdkSnapshot() bool {
return b.SupportsSdk
}