Allow sdk snapshot to contain source module type

Bug: 181569894
Test: m nothing
Change-Id: I30513dd22e2719099a1a1ef63cacc98336d02e9f
This commit is contained in:
Paul Duffin
2021-05-10 23:58:40 +01:00
parent 83ad956ec4
commit 0d4ed0ac56
2 changed files with 26 additions and 10 deletions

View File

@@ -405,6 +405,10 @@ type SdkMemberType interface {
// the module is not allowed in whichever sdk property it was added.
IsInstance(module Module) bool
// UsesSourceModuleTypeInSnapshot returns true when the AddPrebuiltModule() method returns a
// source module type.
UsesSourceModuleTypeInSnapshot() bool
// Add a prebuilt module that the sdk will populate.
//
// The sdk module code generates the snapshot as follows:
@@ -451,6 +455,11 @@ type SdkMemberTypeBase struct {
PropertyName string
SupportsSdk bool
HostOsDependent bool
// When set to true UseSourceModuleTypeInSnapshot indicates that the member type creates a source
// module type in its SdkMemberType.AddPrebuiltModule() method. That prevents the sdk snapshot
// code from automatically adding a prefer: true flag.
UseSourceModuleTypeInSnapshot bool
}
func (b *SdkMemberTypeBase) SdkPropertyName() string {
@@ -465,6 +474,10 @@ func (b *SdkMemberTypeBase) IsHostOsDependent() bool {
return b.HostOsDependent
}
func (b *SdkMemberTypeBase) UsesSourceModuleTypeInSnapshot() bool {
return b.UseSourceModuleTypeInSnapshot
}
// Encapsulates the information about registered SdkMemberTypes.
type SdkMemberTypesRegistry struct {
// The list of types sorted by property name.