Loading apex/apex.go +0 −5 Original line number Diff line number Diff line Loading @@ -2740,11 +2740,6 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string { return "" } 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 { Loading apex/apex_test.go +32 −0 Original line number Diff line number Diff line Loading @@ -2191,6 +2191,38 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { `) } func TestApexMinSdkVersion_MinApiForArch(t *testing.T) { // Tests that an apex dependency with min_sdk_version higher than the // min_sdk_version of the apex is allowed as long as the dependency's // min_sdk_version is less than or equal to the api level that the // architecture was introduced in. In this case, arm64 didn't exist // until api level 21, so the arm64 code will never need to run on // an api level 20 device, even if other architectures of the apex // will. testApex(t, ` apex { name: "myapex", key: "myapex.key", native_shared_libs: ["libfoo"], min_sdk_version: "20", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libfoo", srcs: ["mylib.cpp"], apex_available: ["myapex"], min_sdk_version: "21", stl: "none", } `) } func TestJavaStableSdkVersion(t *testing.T) { testCases := []struct { name string Loading cc/api_level.go +2 −2 Original line number Diff line number Diff line Loading @@ -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 { Loading @@ -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 } Loading cc/cc.go +10 −0 Original line number Diff line number Diff line Loading @@ -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) } Loading Loading
apex/apex.go +0 −5 Original line number Diff line number Diff line Loading @@ -2740,11 +2740,6 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string { return "" } 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 { Loading
apex/apex_test.go +32 −0 Original line number Diff line number Diff line Loading @@ -2191,6 +2191,38 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { `) } func TestApexMinSdkVersion_MinApiForArch(t *testing.T) { // Tests that an apex dependency with min_sdk_version higher than the // min_sdk_version of the apex is allowed as long as the dependency's // min_sdk_version is less than or equal to the api level that the // architecture was introduced in. In this case, arm64 didn't exist // until api level 21, so the arm64 code will never need to run on // an api level 20 device, even if other architectures of the apex // will. testApex(t, ` apex { name: "myapex", key: "myapex.key", native_shared_libs: ["libfoo"], min_sdk_version: "20", } apex_key { name: "myapex.key", public_key: "testkey.avbpubkey", private_key: "testkey.pem", } cc_library { name: "libfoo", srcs: ["mylib.cpp"], apex_available: ["myapex"], min_sdk_version: "21", stl: "none", } `) } func TestJavaStableSdkVersion(t *testing.T) { testCases := []struct { name string Loading
cc/api_level.go +2 −2 Original line number Diff line number Diff line Loading @@ -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 { Loading @@ -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 } Loading
cc/cc.go +10 −0 Original line number Diff line number Diff line Loading @@ -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) } Loading