Use module name as the suffix for apex variant

apex {
    name: "myapex",
    native_shared_libs: ["libfoo"],
    apex_name: "apex_name",
}

override_apex {
    name: "myapex.override",
    base: "myapex"
}

Previsouly, above wasn't supported because both APEXes have the same
apex_name and that apex_name is used as the suffix of libfoo. i.e.,
there are two libfoo.apex_name modules defined.

Now, the two apex variants of libfoo are named as
libfoo.myapex and libfoo.myapex.override.

Bug: 140136207
Test: m
Change-Id: I63f8a1de463011c6e0b97f5f6eee83103e22bc30
This commit is contained in:
Jiyong Park
2020-02-05 17:19:28 +09:00
parent 26a6eb7971
commit db334861b2
2 changed files with 42 additions and 7 deletions

View File

@@ -2209,11 +2209,12 @@ func TestDependenciesInApexManifest(t *testing.T) {
}
func TestApexName(t *testing.T) {
ctx, _ := testApex(t, `
ctx, config := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
apex_name: "com.android.myapex",
native_shared_libs: ["mylib"],
}
apex_key {
@@ -2221,6 +2222,17 @@ func TestApexName(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],
system_shared_libs: [],
stl: "none",
apex_available: [
"//apex_available:platform",
"myapex",
],
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
@@ -2228,6 +2240,16 @@ func TestApexName(t *testing.T) {
ensureContains(t, apexManifestRule.Args["opt"], "-v name com.android.myapex")
apexRule := module.Rule("apexRule")
ensureContains(t, apexRule.Args["opt_flags"], "--do_not_check_keyname")
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, config, "", apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
androidMk := builder.String()
ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n")
ensureNotContains(t, androidMk, "LOCAL_MODULE := mylib.com.android.myapex\n")
}
func TestNonTestApex(t *testing.T) {