Merge "Extract DepIsInSameApex and RequiredSdks interfaces" am: 2010598a51
Change-Id: I2a32d1dcdfbf486d3f583665ce8b0608d599dc07
This commit is contained in:
commit
2a9b7c8791
4 changed files with 27 additions and 10 deletions
|
@ -32,6 +32,14 @@ type ApexInfo struct {
|
|||
MinSdkVersion int
|
||||
}
|
||||
|
||||
// Extracted from ApexModule to make it easier to define custom subsets of the
|
||||
// ApexModule interface and improve code navigation within the IDE.
|
||||
type DepIsInSameApex interface {
|
||||
// DepIsInSameApex tests if the other module 'dep' is installed to the same
|
||||
// APEX as this module
|
||||
DepIsInSameApex(ctx BaseModuleContext, dep Module) bool
|
||||
}
|
||||
|
||||
// ApexModule is the interface that a module type is expected to implement if
|
||||
// the module has to be built differently depending on whether the module
|
||||
// is destined for an apex or not (installed to one of the regular partitions).
|
||||
|
@ -49,6 +57,8 @@ type ApexInfo struct {
|
|||
// respectively.
|
||||
type ApexModule interface {
|
||||
Module
|
||||
DepIsInSameApex
|
||||
|
||||
apexModuleBase() *ApexModuleBase
|
||||
|
||||
// Marks that this module should be built for the specified APEXes.
|
||||
|
@ -88,10 +98,6 @@ type ApexModule interface {
|
|||
// Tests if this module is available for the specified APEX or ":platform"
|
||||
AvailableFor(what string) bool
|
||||
|
||||
// DepIsInSameApex tests if the other module 'dep' is installed to the same
|
||||
// APEX as this module
|
||||
DepIsInSameApex(ctx BaseModuleContext, dep Module) bool
|
||||
|
||||
// Returns the highest version which is <= maxSdkVersion.
|
||||
// For example, with maxSdkVersion is 10 and versionList is [9,11]
|
||||
// it returns 9 as string
|
||||
|
|
|
@ -22,17 +22,30 @@ import (
|
|||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
// Extracted from SdkAware to make it easier to define custom subsets of the
|
||||
// SdkAware interface and improve code navigation within the IDE.
|
||||
//
|
||||
// In addition to its use in SdkAware this interface must also be implemented by
|
||||
// APEX to specify the SDKs required by that module and its contents. e.g. APEX
|
||||
// is expected to implement RequiredSdks() by reading its own properties like
|
||||
// `uses_sdks`.
|
||||
type RequiredSdks interface {
|
||||
// The set of SDKs required by an APEX and its contents.
|
||||
RequiredSdks() SdkRefs
|
||||
}
|
||||
|
||||
// SdkAware is the interface that must be supported by any module to become a member of SDK or to be
|
||||
// built with SDK
|
||||
type SdkAware interface {
|
||||
Module
|
||||
RequiredSdks
|
||||
|
||||
sdkBase() *SdkBase
|
||||
MakeMemberOf(sdk SdkRef)
|
||||
IsInAnySdk() bool
|
||||
ContainingSdk() SdkRef
|
||||
MemberName() string
|
||||
BuildWithSdks(sdks SdkRefs)
|
||||
RequiredSdks() SdkRefs
|
||||
}
|
||||
|
||||
// SdkRef refers to a version of an SDK
|
||||
|
|
|
@ -865,9 +865,7 @@ func apexDepsMutator(mctx android.TopDownMutatorContext) {
|
|||
return
|
||||
}
|
||||
|
||||
cur := mctx.Module().(interface {
|
||||
DepIsInSameApex(android.BaseModuleContext, android.Module) bool
|
||||
})
|
||||
cur := mctx.Module().(android.DepIsInSameApex)
|
||||
|
||||
mctx.VisitDirectDeps(func(child android.Module) {
|
||||
depName := mctx.OtherModuleName(child)
|
||||
|
|
|
@ -434,8 +434,8 @@ func sdkDepsReplaceMutator(mctx android.BottomUpMutatorContext) {
|
|||
// Step 6: ensure that the dependencies from outside of the APEX are all from the required SDKs
|
||||
func sdkRequirementsMutator(mctx android.TopDownMutatorContext) {
|
||||
if m, ok := mctx.Module().(interface {
|
||||
DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool
|
||||
RequiredSdks() android.SdkRefs
|
||||
android.DepIsInSameApex
|
||||
android.RequiredSdks
|
||||
}); ok {
|
||||
requiredSdks := m.RequiredSdks()
|
||||
if len(requiredSdks) == 0 {
|
||||
|
|
Loading…
Reference in a new issue