Sort and uniqify dangling rules list
Make the dangling rules list sorted and unique in order to avoid very long lists when a dangling rule is referenced many times. Also prettify the output by indenting the list and printing "stopping" instead of a blank line for the fatal. Test: m checkbuild Change-Id: I8f7c27ae39b59f506b529d9995d90b0d6b9835d1
This commit is contained in:
parent
17ef5635fa
commit
63b4e0f5c1
1 changed files with 13 additions and 6 deletions
|
@ -18,6 +18,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ func testForDanglingRules(ctx Context, config Config) {
|
||||||
bootstrapDir := filepath.Join(outDir, "soong", ".bootstrap")
|
bootstrapDir := filepath.Join(outDir, "soong", ".bootstrap")
|
||||||
miniBootstrapDir := filepath.Join(outDir, "soong", ".minibootstrap")
|
miniBootstrapDir := filepath.Join(outDir, "soong", ".minibootstrap")
|
||||||
|
|
||||||
var danglingRules []string
|
danglingRules := make(map[string]bool)
|
||||||
|
|
||||||
scanner := bufio.NewScanner(stdout)
|
scanner := bufio.NewScanner(stdout)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
|
@ -70,16 +71,22 @@ func testForDanglingRules(ctx Context, config Config) {
|
||||||
// full build rules in the primary build.ninja file.
|
// full build rules in the primary build.ninja file.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
danglingRules = append(danglingRules, line)
|
danglingRules[line] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.WaitOrFatal()
|
cmd.WaitOrFatal()
|
||||||
|
|
||||||
if len(danglingRules) > 0 {
|
var danglingRulesList []string
|
||||||
|
for rule := range danglingRules {
|
||||||
|
danglingRulesList = append(danglingRulesList, rule)
|
||||||
|
}
|
||||||
|
sort.Strings(danglingRulesList)
|
||||||
|
|
||||||
|
if len(danglingRulesList) > 0 {
|
||||||
ctx.Println("Dependencies in out found with no rule to create them:")
|
ctx.Println("Dependencies in out found with no rule to create them:")
|
||||||
for _, dep := range danglingRules {
|
for _, dep := range danglingRulesList {
|
||||||
ctx.Println(dep)
|
ctx.Println(" ", dep)
|
||||||
}
|
}
|
||||||
ctx.Fatal("")
|
ctx.Fatal("stopping")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue