Fix Make modules name conflict for override_apex

When an override_apex named Foo overrides an apex module named Bar, the
Make modules from Foo have Foo as their suffix. Previously the suffix
was Bar for both of the overriding and the overridden APEXes, causing
name conflicts in the Make side.

Bug: 144338929
Test: apex_test.go
Change-Id: I1396910ab294ba5f5e0585af6d37f1eab9460250
This commit is contained in:
Jaewoong Jung
2019-11-22 14:50:42 -08:00
committed by Jiyong Park
parent 9d78c66ac3
commit 1670ca0d8b
3 changed files with 34 additions and 17 deletions

View File

@@ -2934,7 +2934,7 @@ func TestApexAvailable(t *testing.T) {
}
func TestOverrideApex(t *testing.T) {
ctx, _ := testApex(t, `
ctx, config := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
@@ -2974,6 +2974,23 @@ func TestOverrideApex(t *testing.T) {
ensureNotContains(t, copyCmds, "image.apex/app/app/app.apk")
ensureContains(t, copyCmds, "image.apex/app/app/override_app.apk")
apexBundle := module.Module().(*apexBundle)
name := apexBundle.Name()
if name != "override_myapex" {
t.Errorf("name should be \"override_myapex\", but was %q", name)
}
data := android.AndroidMkDataForTest(t, config, "", apexBundle)
var builder strings.Builder
data.Custom(&builder, name, "TARGET_", "", data)
androidMk := builder.String()
ensureContains(t, androidMk, "LOCAL_MODULE := app.override_myapex")
ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.override_myapex")
ensureContains(t, androidMk, "LOCAL_MODULE_STEM := override_myapex.apex")
ensureNotContains(t, androidMk, "LOCAL_MODULE := app.myapex")
ensureNotContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.myapex")
ensureNotContains(t, androidMk, "LOCAL_MODULE_STEM := myapex.apex")
}
func TestMain(m *testing.M) {