Merge "Make licenseModule SdkAware"

This commit is contained in:
Paul Duffin
2021-05-07 12:31:03 +00:00
committed by Gerrit Code Review
3 changed files with 15 additions and 3 deletions

View File

@@ -51,6 +51,7 @@ type licenseProperties struct {
type licenseModule struct {
ModuleBase
DefaultableModuleBase
SdkBase
properties licenseProperties
}
@@ -75,6 +76,7 @@ func LicenseFactory() Module {
// The visibility property needs to be checked and parsed by the visibility module.
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
InitSdkAwareModule(module)
initAndroidModuleBase(module)
InitDefaultableModule(module)

View File

@@ -41,6 +41,11 @@ type sdkAwareWithoutModule interface {
sdkBase() *SdkBase
MakeMemberOf(sdk SdkRef)
IsInAnySdk() bool
// IsVersioned determines whether the module is versioned, i.e. has a name of the form
// <name>@<version>
IsVersioned() bool
ContainingSdk() SdkRef
MemberName() string
BuildWithSdks(sdks SdkRefs)
@@ -140,6 +145,11 @@ func (s *SdkBase) IsInAnySdk() bool {
return s.properties.ContainingSdk != nil
}
// IsVersioned returns true if this module is versioned.
func (s *SdkBase) IsVersioned() bool {
return strings.Contains(s.module.Name(), "@")
}
// ContainingSdk returns the SDK that this module is a member of
func (s *SdkBase) ContainingSdk() SdkRef {
if s.properties.ContainingSdk != nil {