add [static|shared].apex_available to cc_library
apex_available property can be appended differently per the linkage type. This will be used to restrict certain libs (e.g. libc_malloc_debug) to an APEX while allowing them to be statically linkable from platform for testing purpose. Test: m (apex_test amended) Change-Id: I6dec23129c5ac93a3ef06fea28f26f240c0ba410
This commit is contained in:
@@ -2407,6 +2407,36 @@ func TestApexAvailable(t *testing.T) {
|
||||
// check that libfoo is created only for the platform
|
||||
ensureListNotContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_core_shared_myapex")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_core_shared")
|
||||
|
||||
ctx, _ = testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
native_shared_libs: ["libfoo"],
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libfoo",
|
||||
stl: "none",
|
||||
system_shared_libs: [],
|
||||
apex_available: ["myapex"],
|
||||
static: {
|
||||
apex_available: ["//apex_available:platform"],
|
||||
},
|
||||
}`)
|
||||
|
||||
// shared variant of libfoo is only available to myapex
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_core_shared_myapex")
|
||||
ensureListNotContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_core_shared")
|
||||
// but the static variant is available to both myapex and the platform
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_core_static_myapex")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo"), "android_arm64_armv8-a_core_static")
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
Reference in New Issue
Block a user