Add ModuleWithMinSdkVersionCheck type.

This is to help following refactor for individual modules to have their
own version of checking where needed.

For example, apk in apex may want to enforce it's own version of
CheckMinSdkVersion.

Bug: 205923322
Test: presubmit
Change-Id: Ia2fad6c52af39e21f65385bcb283f1e3adab5548
Merged-In: Ia2fad6c52af39e21f65385bcb283f1e3adab5548
(cherry picked from commit b3fd411465)
This commit is contained in:
satayev
2021-12-02 13:59:35 +00:00
parent 3f6bbd9d56
commit cb0977f67e
3 changed files with 10 additions and 9 deletions

View File

@@ -1631,7 +1631,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// 1) do some validity checks such as apex_available, min_sdk_version, etc.
a.checkApexAvailability(ctx)
a.checkUpdatable(ctx)
a.checkMinSdkVersion(ctx)
a.CheckMinSdkVersion(ctx)
a.checkStaticLinkingToStubLibraries(ctx)
if len(a.properties.Tests) > 0 && !a.testApex {
ctx.PropertyErrorf("tests", "property allowed only in apex_test module type")
@@ -2247,13 +2247,13 @@ func overrideApexFactory() android.Module {
// Entures that min_sdk_version of the included modules are equal or less than the min_sdk_version
// of this apexBundle.
func (a *apexBundle) checkMinSdkVersion(ctx android.ModuleContext) {
func (a *apexBundle) CheckMinSdkVersion(ctx android.ModuleContext) {
if a.testApex || a.vndkApex {
return
}
// apexBundle::minSdkVersion reports its own errors.
minSdkVersion := a.minSdkVersion(ctx)
android.CheckMinSdkVersion(a, ctx, minSdkVersion)
android.CheckMinSdkVersion(ctx, minSdkVersion, a.WalkPayloadDeps)
}
func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) android.ApiLevel {