Allow module types to force creation of a default APEX variant

Bug: 187910671
Test: m droid
Change-Id: I797d4ab60d15b526744fe6e4df1b55c8b75b0310
This commit is contained in:
Paul Duffin
2021-05-12 16:16:51 +01:00
parent a556647c50
commit b5769c15a3
3 changed files with 19 additions and 3 deletions

View File

@@ -203,6 +203,12 @@ type ApexModule interface {
// apex_available property of the module.
AvailableFor(what string) bool
// AlwaysRequiresPlatformApexVariant allows the implementing module to determine whether an
// APEX mutator should always be created for it.
//
// Returns false by default.
AlwaysRequiresPlatformApexVariant() bool
// Returns true if this module is not available to platform (i.e. apex_available property
// doesn't have "//apex_available:platform"), or shouldn't be available to platform, which
// is the case when this module depends on other module that isn't available to platform.
@@ -423,6 +429,11 @@ func (m *ApexModuleBase) AvailableFor(what string) bool {
return CheckAvailableForApex(what, m.ApexProperties.Apex_available)
}
// Implements ApexModule
func (m *ApexModuleBase) AlwaysRequiresPlatformApexVariant() bool {
return false
}
// Implements ApexModule
func (m *ApexModuleBase) NotAvailableForPlatform() bool {
return m.ApexProperties.NotAvailableForPlatform