Replace GetOutputsFromModuleNames with GetWeightedOutputsFromPredicate am: 2621c909e5

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

Change-Id: I9102f23cea1b52c66b0b2964d591c7a8eaf7e8c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeongik Cha 2023-05-04 06:13:59 +00:00 committed by Automerger Merge Worker
commit 1828108878

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)
if ok, weight := predicate(jmWithActions); ok {
for _, a := range jmWithActions.Module["Actions"].([]JSONAction) {
modulesToOutputs[m.Name()] = append(modulesToOutputs[m.Name()], a.Outputs...)
}
// There could be several modules with the same name, so keep looping
for _, o := range a.Outputs {
if val, ok := outputToWeight[o]; ok {
if val > weight {
continue
}
}
return modulesToOutputs
outputToWeight[o] = weight
}
}
}
}
return outputToWeight
}
func inList(s string, l []string) bool {