Start using Providers instead of direct module access
Export information about static libraries, shared libraries and exported flags through Providers instead of accessing the module directly. Much more is left to be converted, but this significantly simplifies the dependencies on libraries with stubs by making it easy for a module to masquerade as another by simply exporting the providers from the other module. Instead of depending on all the versions of a library and then picking which one to use later, it can depend only on the implementation variant and then select the right SharedLibraryInfo from the variant. Test: m checkbuild Test: only expected changes to build.ninja Change-Id: I1fd9eb4d251cf96ed8398d586efc3e0817663c76
This commit is contained in:
@@ -145,11 +145,6 @@ type ApexModule interface {
|
||||
// check-platform-availability mutator in the apex package.
|
||||
SetNotAvailableForPlatform()
|
||||
|
||||
// Returns the highest version which is <= maxSdkVersion.
|
||||
// For example, with maxSdkVersion is 10 and versionList is [9,11]
|
||||
// it returns 9 as string
|
||||
ChooseSdkVersion(ctx BaseModuleContext, versionList []string, maxSdkVersion ApiLevel) (string, error)
|
||||
|
||||
// List of APEXes that this module tests. The module has access to
|
||||
// the private part of the listed APEXes even when it is not included in the
|
||||
// APEXes.
|
||||
@@ -310,20 +305,6 @@ func (m *ApexModuleBase) DepIsInSameApex(ctx BaseModuleContext, dep Module) bool
|
||||
return true
|
||||
}
|
||||
|
||||
func (m *ApexModuleBase) ChooseSdkVersion(ctx BaseModuleContext, versionList []string, maxSdkVersion ApiLevel) (string, error) {
|
||||
for i := range versionList {
|
||||
version := versionList[len(versionList)-i-1]
|
||||
ver, err := ApiLevelFromUser(ctx, version)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if ver.LessThanOrEqualTo(maxSdkVersion) {
|
||||
return version, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("not found a version(<=%s) in versionList: %v", maxSdkVersion, versionList)
|
||||
}
|
||||
|
||||
func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
|
||||
for _, n := range m.ApexProperties.Apex_available {
|
||||
if n == AvailableToPlatform || n == AvailableToAnyApex || n == AvailableToGkiApex {
|
||||
|
Reference in New Issue
Block a user