aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-06-26 23:48:52 -0700
committerColin Cross <ccross@android.com>2018-07-09 20:13:52 +0000
commit63b4e0f5c15276cc5d2b04d12f914798521eed8a (patch)
treeb0a394a27f82a22dcbadb44a1c896f9b96f988b6
parent17ef5635fa1b81a0aa41f6ad094afc740444db36 (diff)
downloadbuild_soong-63b4e0f5c15276cc5d2b04d12f914798521eed8a.tar.gz
build_soong-63b4e0f5c15276cc5d2b04d12f914798521eed8a.tar.bz2
build_soong-63b4e0f5c15276cc5d2b04d12f914798521eed8a.zip
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
-rw-r--r--ui/build/test_build.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/ui/build/test_build.go b/ui/build/test_build.go
index 940f0c89..4bc4c977 100644
--- a/ui/build/test_build.go
+++ b/ui/build/test_build.go
@@ -18,6 +18,7 @@ import (
"bufio"
"path/filepath"
"runtime"
+ "sort"
"strings"
)
@@ -56,7 +57,7 @@ func testForDanglingRules(ctx Context, config Config) {
bootstrapDir := filepath.Join(outDir, "soong", ".bootstrap")
miniBootstrapDir := filepath.Join(outDir, "soong", ".minibootstrap")
- var danglingRules []string
+ danglingRules := make(map[string]bool)
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
@@ -70,16 +71,22 @@ func testForDanglingRules(ctx Context, config Config) {
// full build rules in the primary build.ninja file.
continue
}
- danglingRules = append(danglingRules, line)
+ danglingRules[line] = true
}
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:")
- for _, dep := range danglingRules {
- ctx.Println(dep)
+ for _, dep := range danglingRulesList {
+ ctx.Println(" ", dep)
}
- ctx.Fatal("")
+ ctx.Fatal("stopping")
}
}