Merge "Move checking of minApiForArch for apex into cc"

This commit is contained in:
Colin Cross
2022-10-13 20:15:30 +00:00
committed by Gerrit Code Review
4 changed files with 44 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ import (
"android/soong/android"
)
func MinApiForArch(ctx android.EarlyModuleContext,
func minApiForArch(ctx android.EarlyModuleContext,
arch android.ArchType) android.ApiLevel {
switch arch {
@@ -38,7 +38,7 @@ func MinApiForArch(ctx android.EarlyModuleContext,
func nativeApiLevelFromUser(ctx android.BaseModuleContext,
raw string) (android.ApiLevel, error) {
min := MinApiForArch(ctx, ctx.Arch().ArchType)
min := minApiForArch(ctx, ctx.Arch().ArchType)
if raw == "minimum" {
return min, nil
}

View File

@@ -3626,6 +3626,16 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
return err
}
// A dependency only needs to support a min_sdk_version at least
// as high as the api level that the architecture was introduced in.
// This allows introducing new architectures in the platform that
// need to be included in apexes that normally require an older
// min_sdk_version.
minApiForArch := minApiForArch(ctx, c.Target().Arch.ArchType)
if sdkVersion.LessThan(minApiForArch) {
sdkVersion = minApiForArch
}
if ver.GreaterThan(sdkVersion) {
return fmt.Errorf("newer SDK(%v)", ver)
}