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:
@@ -79,12 +79,14 @@ type AndroidMkEntries struct {
|
||||
header bytes.Buffer
|
||||
footer bytes.Buffer
|
||||
|
||||
AddCustomEntries func(name, prefix, moduleDir string, entries *AndroidMkEntries)
|
||||
ExtraEntries []AndroidMkExtraEntriesFunc
|
||||
|
||||
EntryMap map[string][]string
|
||||
entryOrder []string
|
||||
}
|
||||
|
||||
type AndroidMkExtraEntriesFunc func(entries *AndroidMkEntries)
|
||||
|
||||
func (a *AndroidMkEntries) SetString(name, value string) {
|
||||
if _, ok := a.EntryMap[name]; !ok {
|
||||
a.entryOrder = append(a.entryOrder, name)
|
||||
@@ -246,9 +248,8 @@ func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod bluep
|
||||
prefix = "2ND_" + prefix
|
||||
}
|
||||
}
|
||||
blueprintDir := filepath.Dir(bpPath)
|
||||
if a.AddCustomEntries != nil {
|
||||
a.AddCustomEntries(name, prefix, blueprintDir, a)
|
||||
for _, extra := range a.ExtraEntries {
|
||||
extra(a)
|
||||
}
|
||||
|
||||
// Write to footer.
|
||||
|
Reference in New Issue
Block a user