AndroidMkEntries minor refactoring.

This includes a few changes that make AndroidMkEntries more resemble
AndroidMkData, especially in terms of how extra entries are added.
Most importantly it can now have multiple custom functions.

Test: Soong tests
Change-Id: Ibf9102624d16d0c1c9894a2794fc7c797bb34c9a
This commit is contained in:
Jaewoong Jung
2019-08-27 17:33:16 -07:00
parent 21738f6032
commit e0dc8dfd22
6 changed files with 60 additions and 47 deletions

View File

@@ -155,16 +155,18 @@ func (p *PrebuiltEtc) AndroidMkEntries() AndroidMkEntries {
Class: "ETC",
SubName: nameSuffix,
OutputFile: OptionalPathForPath(p.outputFilePath),
AddCustomEntries: func(name, prefix, moduleDir string, entries *AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional")
entries.SetString("LOCAL_MODULE_PATH", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
entries.SetString("LOCAL_UNINSTALLABLE_MODULE", strconv.FormatBool(!p.Installable()))
if p.additionalDependencies != nil {
for _, path := range *p.additionalDependencies {
entries.SetString("LOCAL_ADDITIONAL_DEPENDENCIES", path.String())
ExtraEntries: []AndroidMkExtraEntriesFunc{
func(entries *AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional")
entries.SetString("LOCAL_MODULE_PATH", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
entries.SetString("LOCAL_UNINSTALLABLE_MODULE", strconv.FormatBool(!p.Installable()))
if p.additionalDependencies != nil {
for _, path := range *p.additionalDependencies {
entries.SetString("LOCAL_ADDITIONAL_DEPENDENCIES", path.String())
}
}
}
},
},
}
}