Revert "Suppress all progress messages from Ninja if ANDROID_QUIET_BUILD is set."

Reverts commit 827aead340
The change being reverted is the result of misunderstanding of how the
status system works. It has to be reverted because it would suppress
_all_ error messages from Make. Achieving what this change purports is
is more involved and requires changing the code to separate progress message
stream from application output stream.

Test: run failing build with ANDROID_QUIET_BUILD=tree and observe errors being output
Change-Id: If9148a7fa773ae32fb0870a448e9470560e53900
This commit is contained in:
Sasha Smundak
2022-05-06 16:04:44 -07:00
parent 7c81cf6e4e
commit 2cec8df3a8
2 changed files with 12 additions and 21 deletions

View File

@@ -22,30 +22,24 @@ import (
)
type simpleStatusOutput struct {
writer io.Writer
formatter formatter
keepANSI bool
outputLevel status.MsgLevel
writer io.Writer
formatter formatter
keepANSI bool
}
// NewSimpleStatusOutput returns a StatusOutput that represents the
// current build status similarly to Ninja's built-in terminal
// output.
func NewSimpleStatusOutput(w io.Writer, formatter formatter, keepANSI bool, quietBuild bool) status.StatusOutput {
level := status.StatusLvl
if quietBuild {
level = status.PrintLvl
}
func NewSimpleStatusOutput(w io.Writer, formatter formatter, keepANSI bool) status.StatusOutput {
return &simpleStatusOutput{
writer: w,
formatter: formatter,
keepANSI: keepANSI,
outputLevel: level,
writer: w,
formatter: formatter,
keepANSI: keepANSI,
}
}
func (s *simpleStatusOutput) Message(level status.MsgLevel, message string) {
if level >= s.outputLevel {
if level >= status.StatusLvl {
output := s.formatter.message(level, message)
if !s.keepANSI {
output = string(stripAnsiEscapes([]byte(output)))
@@ -54,13 +48,10 @@ func (s *simpleStatusOutput) Message(level status.MsgLevel, message string) {
}
}
func (s *simpleStatusOutput) StartAction(_ *status.Action, _ status.Counts) {
func (s *simpleStatusOutput) StartAction(action *status.Action, counts status.Counts) {
}
func (s *simpleStatusOutput) FinishAction(result status.ActionResult, counts status.Counts) {
if s.outputLevel > status.StatusLvl {
return
}
str := result.Description
if str == "" {
str = result.Command

View File

@@ -29,9 +29,9 @@ import (
func NewStatusOutput(w io.Writer, statusFormat string, forceSimpleOutput, quietBuild, forceKeepANSI bool) status.StatusOutput {
formatter := newFormatter(statusFormat, quietBuild)
if forceSimpleOutput || quietBuild || !isSmartTerminal(w) {
return NewSimpleStatusOutput(w, formatter, forceKeepANSI, quietBuild)
} else {
if !forceSimpleOutput && isSmartTerminal(w) {
return NewSmartStatusOutput(w, formatter)
} else {
return NewSimpleStatusOutput(w, formatter, forceKeepANSI)
}
}