Merge "arch specific dependencies are supported for apex"

This commit is contained in:
Treehugger Robot
2020-12-17 00:15:26 +00:00
committed by Gerrit Code Review
2 changed files with 91 additions and 0 deletions

View File

@@ -3891,6 +3891,64 @@ func TestApexWithTarget(t *testing.T) {
ensureListContains(t, ctx.ModuleVariantsForTests("mylib2"), "android_arm64_armv8-a_shared")
}
func TestApexWithArch(t *testing.T) {
ctx, _ := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
arch: {
arm64: {
native_shared_libs: ["mylib.arm64"],
},
x86_64: {
native_shared_libs: ["mylib.x64"],
},
}
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib.arm64",
srcs: ["mylib.cpp"],
system_shared_libs: [],
stl: "none",
// TODO: remove //apex_available:platform
apex_available: [
"//apex_available:platform",
"myapex",
],
}
cc_library {
name: "mylib.x64",
srcs: ["mylib.cpp"],
system_shared_libs: [],
stl: "none",
// TODO: remove //apex_available:platform
apex_available: [
"//apex_available:platform",
"myapex",
],
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that apex variant is created for the direct dep
ensureListContains(t, ctx.ModuleVariantsForTests("mylib.arm64"), "android_arm64_armv8-a_shared_apex10000")
ensureListNotContains(t, ctx.ModuleVariantsForTests("mylib.x64"), "android_arm64_armv8-a_shared_apex10000")
// Ensure that both direct and indirect deps are copied into apex
ensureContains(t, copyCmds, "image.apex/lib64/mylib.arm64.so")
ensureNotContains(t, copyCmds, "image.apex/lib64/mylib.x64.so")
}
func TestApexWithShBinary(t *testing.T) {
ctx, _ := testApex(t, `
apex {