Merge "Apex: support codenames for min_sdk_version"
This commit is contained in:
@@ -1144,6 +1144,60 @@ func TestApexUseStubsAccordingToMinSdkVersionInUnbundledBuild(t *testing.T) {
|
||||
expectNoLink("liba", "shared_otherapex", "libz", "shared")
|
||||
}
|
||||
|
||||
func TestApexMinSdkVersion_SupportsCodeNames(t *testing.T) {
|
||||
ctx, _ := testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["libx"],
|
||||
min_sdk_version: "R",
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libx",
|
||||
shared_libs: ["libz"],
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
apex_available: [ "myapex" ],
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libz",
|
||||
system_shared_libs: [],
|
||||
stl: "none",
|
||||
stubs: {
|
||||
versions: ["29", "R"],
|
||||
},
|
||||
}
|
||||
`, func(fs map[string][]byte, config android.Config) {
|
||||
config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
|
||||
})
|
||||
|
||||
expectLink := func(from, from_variant, to, to_variant string) {
|
||||
ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
|
||||
ensureContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
|
||||
}
|
||||
expectNoLink := func(from, from_variant, to, to_variant string) {
|
||||
ldArgs := ctx.ModuleForTests(from, "android_arm64_armv8-a_"+from_variant).Rule("ld").Args["libFlags"]
|
||||
ensureNotContains(t, ldArgs, "android_arm64_armv8-a_"+to_variant+"/"+to+".so")
|
||||
}
|
||||
// 9000 is quite a magic number.
|
||||
// Finalized SDK codenames are mapped as P(28), Q(29), ...
|
||||
// And, codenames which are not finalized yet(active_codenames + future_codenames) are numbered from 9000, 9001, ...
|
||||
// to distinguish them from finalized and future_api(10000)
|
||||
// In this test, "R" is assumed not finalized yet( listed in Platform_version_active_codenames) and translated into 9000
|
||||
// (refer android/api_levels.go)
|
||||
expectLink("libx", "shared_myapex", "libz", "shared_9000")
|
||||
expectNoLink("libx", "shared_myapex", "libz", "shared_29")
|
||||
expectNoLink("libx", "shared_myapex", "libz", "shared")
|
||||
}
|
||||
|
||||
func TestApexMinSdkVersionDefaultsToLatest(t *testing.T) {
|
||||
ctx, _ := testApex(t, `
|
||||
apex {
|
||||
@@ -1334,11 +1388,11 @@ func TestInvalidMinSdkVersion(t *testing.T) {
|
||||
}
|
||||
`)
|
||||
|
||||
testApexError(t, `"myapex" .*: min_sdk_version: should be "current" or <number>`, `
|
||||
testApexError(t, `"myapex" .*: min_sdk_version: SDK version should be .*`, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
min_sdk_version: "R",
|
||||
min_sdk_version: "abc",
|
||||
}
|
||||
|
||||
apex_key {
|
||||
|
Reference in New Issue
Block a user