Merge "Allow module types to force creation of a default APEX variant" am: 9896b3424b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1705263 Change-Id: Ib78cf134090a9c8a955ac262399c88e0aaee2ee2
This commit is contained in:
@@ -203,6 +203,12 @@ type ApexModule interface {
|
|||||||
// apex_available property of the module.
|
// apex_available property of the module.
|
||||||
AvailableFor(what string) bool
|
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
|
// 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
|
// 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.
|
// 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)
|
return CheckAvailableForApex(what, m.ApexProperties.Apex_available)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements ApexModule
|
||||||
|
func (m *ApexModuleBase) AlwaysRequiresPlatformApexVariant() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Implements ApexModule
|
// Implements ApexModule
|
||||||
func (m *ApexModuleBase) NotAvailableForPlatform() bool {
|
func (m *ApexModuleBase) NotAvailableForPlatform() bool {
|
||||||
return m.ApexProperties.NotAvailableForPlatform
|
return m.ApexProperties.NotAvailableForPlatform
|
||||||
|
@@ -1013,9 +1013,8 @@ func markPlatformAvailability(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Exception 1: stub libraries and native bridge libraries are always available to platform
|
// Exception 1: check to see if the module always requires it.
|
||||||
if cc, ok := mctx.Module().(*cc.Module); ok &&
|
if am.AlwaysRequiresPlatformApexVariant() {
|
||||||
(cc.IsStubs() || cc.Target().NativeBridge == android.NativeBridgeEnabled) {
|
|
||||||
availableToPlatform = true
|
availableToPlatform = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
cc/cc.go
6
cc/cc.go
@@ -3296,6 +3296,12 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implements android.ApexModule
|
||||||
|
func (c *Module) AlwaysRequiresPlatformApexVariant() bool {
|
||||||
|
// stub libraries and native bridge libraries are always available to platform
|
||||||
|
return c.IsStubs() || c.Target().NativeBridge == android.NativeBridgeEnabled
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Defaults
|
// Defaults
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user