AndroidMk for the hostdex library has separate AndroidMkEntries
Previously, the -hostdex library was emitted using the ExtraFooters.
Now, it has its own AndroidMkEntries, which can be returned together
with the AndroidMkEntries for the main library.
Bug: 128708192
Test: m
Change-Id: Ic9eb0d3839572ed340ccbc5fc6c4b54241e1cb24
diff --git a/java/androidmk_test.go b/java/androidmk_test.go
index 9673576..acc6bf0 100644
--- a/java/androidmk_test.go
+++ b/java/androidmk_test.go
@@ -50,17 +50,23 @@
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
- entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
+ entriesList := android.AndroidMkEntriesForTest(t, config, "", mod)
+ if len(entriesList) != 2 {
+ t.Errorf("two entries are expected, but got %d", len(entriesList))
+ }
+ mainEntries := &entriesList[0]
expected := []string{"foo"}
- actual := entries.EntryMap["LOCAL_MODULE"]
+ actual := mainEntries.EntryMap["LOCAL_MODULE"]
if !reflect.DeepEqual(expected, actual) {
t.Errorf("Unexpected module name - expected: %q, actual: %q", expected, actual)
}
- footerLines := entries.FooterLinesForTests()
- if !android.InList("LOCAL_MODULE := foo-hostdex", footerLines) {
- t.Errorf("foo-hostdex is not found in the footers: %q", footerLines)
+ subEntries := &entriesList[1]
+ expected = []string{"foo-hostdex"}
+ actual = subEntries.EntryMap["LOCAL_MODULE"]
+ if !reflect.DeepEqual(expected, actual) {
+ t.Errorf("Unexpected module name - expected: %q, actual: %q", expected, actual)
}
}
@@ -75,17 +81,23 @@
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
- entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
+ entriesList := android.AndroidMkEntriesForTest(t, config, "", mod)
+ if len(entriesList) != 2 {
+ t.Errorf("two entries are expected, but got %d", len(entriesList))
+ }
+ mainEntries := &entriesList[0]
expected := []string{"libfoo"}
- actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"]
+ actual := mainEntries.EntryMap["LOCAL_REQUIRED_MODULES"]
if !reflect.DeepEqual(expected, actual) {
t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual)
}
- footerLines := entries.FooterLinesForTests()
- if !android.InList("LOCAL_REQUIRED_MODULES := libfoo", footerLines) {
- t.Errorf("Wrong or missing required line for foo-hostdex in the footers: %q", footerLines)
+ subEntries := &entriesList[1]
+ expected = []string{"libfoo"}
+ actual = subEntries.EntryMap["LOCAL_REQUIRED_MODULES"]
+ if !reflect.DeepEqual(expected, actual) {
+ t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual)
}
}
@@ -104,14 +116,20 @@
`)
mod := ctx.ModuleForTests("foo", "android_common").Module()
- entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
+ entriesList := android.AndroidMkEntriesForTest(t, config, "", mod)
+ if len(entriesList) != 2 {
+ t.Errorf("two entries are expected, but got %d", len(entriesList))
+ }
- if r, ok := entries.EntryMap["LOCAL_REQUIRED_MODULES"]; ok {
+ mainEntries := &entriesList[0]
+ if r, ok := mainEntries.EntryMap["LOCAL_REQUIRED_MODULES"]; ok {
t.Errorf("Unexpected required modules: %q", r)
}
- footerLines := entries.FooterLinesForTests()
- if !android.InList("LOCAL_REQUIRED_MODULES += libfoo", footerLines) {
- t.Errorf("Wrong or missing required line for foo-hostdex in the footers: %q", footerLines)
+ subEntries := &entriesList[1]
+ expected := []string{"libfoo"}
+ actual := subEntries.EntryMap["LOCAL_REQUIRED_MODULES"]
+ if !reflect.DeepEqual(expected, actual) {
+ t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual)
}
}