New AndroidMk authoring system based on entry map.

The new system collects all Android.mk variable assignments using a map
and writes them to io.Writer. Compared to the previous system, which
directly writes all entries to buffers, this new system is more robust
and test-friendly.

Test: Built without prebuilt_etc.go change and diffed the mk output.
Test: prebuilt_etc_test.go
Change-Id: Idd28443d129ff70053295015e69328a8fa3eca47
This commit is contained in:
Jaewoong Jung
2019-04-03 15:47:29 -07:00
parent 8bf9bd9f91
commit 9aa3ab1f3f
5 changed files with 295 additions and 202 deletions

View File

@@ -371,3 +371,14 @@ func FailIfNoMatchingErrors(t *testing.T, pattern string, errs []error) {
}
}
}
func AndroidMkEntriesForTest(t *testing.T, config Config, bpPath string, mod blueprint.Module) AndroidMkEntries {
var p AndroidMkEntriesProvider
var ok bool
if p, ok = mod.(AndroidMkEntriesProvider); !ok {
t.Errorf("module does not implmement AndroidMkEntriesProvider: " + mod.Name())
}
entries := p.AndroidMkEntries()
entries.fillInEntries(config, bpPath, mod)
return entries
}