Use MinApiForArch to set minSdkVersion for apexes
Apexes for new architectures have to increase their minSdkVersion to the minimum supported version for the architecture. Bug: 250918230 Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing Change-Id: I49220cbec628f1508709741dc56b62aaac7786d9
This commit is contained in:
23
apex/apex.go
23
apex/apex.go
@@ -2731,16 +2731,23 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string {
|
|||||||
// Only override the minSdkVersion value on Apexes which already specify
|
// Only override the minSdkVersion value on Apexes which already specify
|
||||||
// a min_sdk_version (it's optional for non-updatable apexes), and that its
|
// a min_sdk_version (it's optional for non-updatable apexes), and that its
|
||||||
// min_sdk_version value is lower than the one to override with.
|
// min_sdk_version value is lower than the one to override with.
|
||||||
overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
|
minApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
|
||||||
overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
|
if minApiLevel.IsNone() {
|
||||||
originalMinApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
|
return ""
|
||||||
isMinSdkSet := a.properties.Min_sdk_version != nil
|
|
||||||
isOverrideValueHigher := overrideApiLevel.CompareTo(originalMinApiLevel) > 0
|
|
||||||
if overrideMinSdkValue != "" && isMinSdkSet && isOverrideValueHigher {
|
|
||||||
return overrideMinSdkValue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return proptools.String(a.properties.Min_sdk_version)
|
archMinApiLevel := cc.MinApiForArch(ctx, a.MultiTargets()[0].Arch.ArchType)
|
||||||
|
if !archMinApiLevel.IsNone() && archMinApiLevel.CompareTo(minApiLevel) > 0 {
|
||||||
|
minApiLevel = archMinApiLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
|
||||||
|
overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
|
||||||
|
if !overrideApiLevel.IsNone() && overrideApiLevel.CompareTo(minApiLevel) > 0 {
|
||||||
|
minApiLevel = overrideApiLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
return minApiLevel.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns apex's min_sdk_version SdkSpec, honoring overrides
|
// Returns apex's min_sdk_version SdkSpec, honoring overrides
|
||||||
|
@@ -20,7 +20,7 @@ import (
|
|||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func minApiForArch(ctx android.BaseModuleContext,
|
func MinApiForArch(ctx android.EarlyModuleContext,
|
||||||
arch android.ArchType) android.ApiLevel {
|
arch android.ArchType) android.ApiLevel {
|
||||||
|
|
||||||
switch arch {
|
switch arch {
|
||||||
@@ -38,7 +38,7 @@ func minApiForArch(ctx android.BaseModuleContext,
|
|||||||
func nativeApiLevelFromUser(ctx android.BaseModuleContext,
|
func nativeApiLevelFromUser(ctx android.BaseModuleContext,
|
||||||
raw string) (android.ApiLevel, error) {
|
raw string) (android.ApiLevel, error) {
|
||||||
|
|
||||||
min := minApiForArch(ctx, ctx.Arch().ArchType)
|
min := MinApiForArch(ctx, ctx.Arch().ArchType)
|
||||||
if raw == "minimum" {
|
if raw == "minimum" {
|
||||||
return min, nil
|
return min, nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user