sh_binary can be included in APEX

Bug: 123891899
Test: m (apex_test amended)

Change-Id: Idebe577b20019fe9cd0fb6617f3b8c52a5b87714
This commit is contained in:
Jiyong Park
2019-02-06 00:16:29 +09:00
parent 94427265d1
commit 04480cf35b
2 changed files with 41 additions and 2 deletions

View File

@@ -47,6 +47,7 @@ func testApex(t *testing.T, bp string) *android.TestContext {
ctx.RegisterModuleType("llndk_library", android.ModuleFactoryAdaptor(cc.LlndkLibraryFactory))
ctx.RegisterModuleType("toolchain_library", android.ModuleFactoryAdaptor(cc.ToolchainLibraryFactory))
ctx.RegisterModuleType("prebuilt_etc", android.ModuleFactoryAdaptor(android.PrebuiltEtcFactory))
ctx.RegisterModuleType("sh_binary", android.ModuleFactoryAdaptor(android.ShBinaryFactory))
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("image", cc.ImageMutator).Parallel()
ctx.BottomUp("link", cc.LinkageMutator).Parallel()
@@ -975,3 +976,31 @@ func TestApexWithTarget(t *testing.T) {
ensureListContains(t, ctx.ModuleVariantsForTests("mylib_common"), "android_arm64_armv8-a_core_shared")
ensureListContains(t, ctx.ModuleVariantsForTests("mylib2"), "android_arm64_armv8-a_core_shared")
}
func TestApexWithShBinary(t *testing.T) {
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
binaries: ["myscript"],
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
sh_binary {
name: "myscript",
src: "mylib.cpp",
filename: "myscript.sh",
sub_dir: "script",
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
ensureContains(t, copyCmds, "image.apex/bin/script/myscript.sh")
}