Replace GetOutputsFromModuleNames with GetWeightedOutputsFromPredicate am: 2621c909e5 am: 1828108878 am: 513b7b0ca9 am: 495550b9a4 am: 15d2ed8603

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2527126

Change-Id: I9069e8362f17c06ab7b1c5318244776c8ee3c39a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeongik Cha 2023-05-04 09:03:35 +00:00 committed by Automerger Merge Worker
commit 04da6d4709

View file

@ -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 {