Replace GetOutputsFromModuleNames with GetWeightedOutputsFromPredicate am: 2621c909e5
am: 1828108878
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2527126 Change-Id: I620d2feaee22960f0a9df50aa1aa81d108b64154 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
513b7b0ca9
1 changed files with 13 additions and 8 deletions
21
context.go
21
context.go
|
@ -2806,19 +2806,24 @@ func getNinjaStringsWithNilPkgNames(nStrs []ninjaString) []string {
|
|||
return strs
|
||||
}
|
||||
|
||||
func (c *Context) GetOutputsFromModuleNames(moduleNames []string) map[string][]string {
|
||||
modulesToOutputs := make(map[string][]string)
|
||||
func (c *Context) GetWeightedOutputsFromPredicate(predicate func(*JsonModule) (bool, int)) map[string]int {
|
||||
outputToWeight := make(map[string]int)
|
||||
for _, m := range c.modulesSorted {
|
||||
if inList(m.Name(), moduleNames) {
|
||||
jmWithActions := jsonModuleWithActionsFromModuleInfo(m)
|
||||
jmWithActions := jsonModuleWithActionsFromModuleInfo(m)
|
||||
if ok, weight := predicate(jmWithActions); ok {
|
||||
for _, a := range jmWithActions.Module["Actions"].([]JSONAction) {
|
||||
modulesToOutputs[m.Name()] = append(modulesToOutputs[m.Name()], a.Outputs...)
|
||||
for _, o := range a.Outputs {
|
||||
if val, ok := outputToWeight[o]; ok {
|
||||
if val > weight {
|
||||
continue
|
||||
}
|
||||
}
|
||||
outputToWeight[o] = weight
|
||||
}
|
||||
}
|
||||
// There could be several modules with the same name, so keep looping
|
||||
}
|
||||
}
|
||||
|
||||
return modulesToOutputs
|
||||
return outputToWeight
|
||||
}
|
||||
|
||||
func inList(s string, l []string) bool {
|
||||
|
|
Loading…
Reference in a new issue