Fix parsing of dangling dep check
Buildbot parses failure messages that look like ninja errors, but this
error doesn't look like a ninja error. We used to output this via
stderr, which buildbot would fall back to, but that had synchronization
issues between stderr and stdout.
So switch this over to use the status API, marking this action as failed
when necessary, which will display a ninja-like error that buildbot can
parse.
Bug: 112007097
Test: add dangling dep, look at output.
Change-Id: Ib2bbba4373ea22ac01af8aa6bbf295296a93e94d
diff --git a/ui/build/test_build.go b/ui/build/test_build.go
index 4bc4c97..348d41f 100644
--- a/ui/build/test_build.go
+++ b/ui/build/test_build.go
@@ -16,10 +16,13 @@
import (
"bufio"
+ "fmt"
"path/filepath"
"runtime"
"sort"
"strings"
+
+ "android/soong/ui/status"
)
// Checks for files in the out directory that have a rule that depends on them but no rule to
@@ -37,6 +40,12 @@
ctx.BeginTrace("test for dangling rules")
defer ctx.EndTrace()
+ ts := ctx.Status.StartTool()
+ action := &status.Action{
+ Description: "Test for dangling rules",
+ }
+ ts.StartAction(action)
+
// Get a list of leaf nodes in the dependency graph from ninja
executable := config.PrebuiltBuildTool("ninja")
@@ -83,10 +92,18 @@
sort.Strings(danglingRulesList)
if len(danglingRulesList) > 0 {
- ctx.Println("Dependencies in out found with no rule to create them:")
+ sb := &strings.Builder{}
+ title := "Dependencies in out found with no rule to create them:"
+ fmt.Fprintln(sb, title)
for _, dep := range danglingRulesList {
- ctx.Println(" ", dep)
+ fmt.Fprintln(sb, " ", dep)
}
+ ts.FinishAction(status.ActionResult{
+ Action: action,
+ Error: fmt.Errorf(title),
+ Output: sb.String(),
+ })
ctx.Fatal("stopping")
}
+ ts.FinishAction(status.ActionResult{Action: action})
}