Merge changes Ib785bd1c,Icd05ee3a into main
* changes: Show ETA only if it is smart status Remove not-used field in smart_status
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
|||||||
type formatter struct {
|
type formatter struct {
|
||||||
format string
|
format string
|
||||||
quiet bool
|
quiet bool
|
||||||
|
smart bool
|
||||||
start time.Time
|
start time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,10 +33,11 @@ type formatter struct {
|
|||||||
// the terminal in a format similar to Ninja.
|
// the terminal in a format similar to Ninja.
|
||||||
// format takes nearly all the same options as NINJA_STATUS.
|
// format takes nearly all the same options as NINJA_STATUS.
|
||||||
// %c is currently unsupported.
|
// %c is currently unsupported.
|
||||||
func newFormatter(format string, quiet bool) formatter {
|
func newFormatter(format string, quiet bool, smart bool) formatter {
|
||||||
return formatter{
|
return formatter{
|
||||||
format: format,
|
format: format,
|
||||||
quiet: quiet,
|
quiet: quiet,
|
||||||
|
smart: smart,
|
||||||
start: time.Now(),
|
start: time.Now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,8 +63,9 @@ func remainingTimeString(t time.Time) string {
|
|||||||
func (s formatter) progress(counts status.Counts) string {
|
func (s formatter) progress(counts status.Counts) string {
|
||||||
if s.format == "" {
|
if s.format == "" {
|
||||||
output := fmt.Sprintf("[%3d%% %d/%d", 100*counts.FinishedActions/counts.TotalActions, counts.FinishedActions, counts.TotalActions)
|
output := fmt.Sprintf("[%3d%% %d/%d", 100*counts.FinishedActions/counts.TotalActions, counts.FinishedActions, counts.TotalActions)
|
||||||
|
// Not to break parsing logic in the build bot
|
||||||
if !counts.EstimatedTime.IsZero() {
|
// TODO(b/313981966): make buildbot more flexible for output format
|
||||||
|
if s.smart && !counts.EstimatedTime.IsZero() {
|
||||||
output += fmt.Sprintf(" %s remaining", remainingTimeString(counts.EstimatedTime))
|
output += fmt.Sprintf(" %s remaining", remainingTimeString(counts.EstimatedTime))
|
||||||
}
|
}
|
||||||
output += "] "
|
output += "] "
|
||||||
|
@@ -31,9 +31,8 @@ import (
|
|||||||
const tableHeightEnVar = "SOONG_UI_TABLE_HEIGHT"
|
const tableHeightEnVar = "SOONG_UI_TABLE_HEIGHT"
|
||||||
|
|
||||||
type actionTableEntry struct {
|
type actionTableEntry struct {
|
||||||
action *status.Action
|
action *status.Action
|
||||||
startTime time.Time
|
startTime time.Time
|
||||||
estimatedEndTime time.Time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type smartStatusOutput struct {
|
type smartStatusOutput struct {
|
||||||
|
@@ -27,9 +27,10 @@ import (
|
|||||||
// statusFormat takes nearly all the same options as NINJA_STATUS.
|
// statusFormat takes nearly all the same options as NINJA_STATUS.
|
||||||
// %c is currently unsupported.
|
// %c is currently unsupported.
|
||||||
func NewStatusOutput(w io.Writer, statusFormat string, forceSimpleOutput, quietBuild, forceKeepANSI bool) status.StatusOutput {
|
func NewStatusOutput(w io.Writer, statusFormat string, forceSimpleOutput, quietBuild, forceKeepANSI bool) status.StatusOutput {
|
||||||
formatter := newFormatter(statusFormat, quietBuild)
|
useSmartStatus := !forceSimpleOutput && isSmartTerminal(w)
|
||||||
|
formatter := newFormatter(statusFormat, quietBuild, useSmartStatus)
|
||||||
|
|
||||||
if !forceSimpleOutput && isSmartTerminal(w) {
|
if useSmartStatus {
|
||||||
return NewSmartStatusOutput(w, formatter)
|
return NewSmartStatusOutput(w, formatter)
|
||||||
} else {
|
} else {
|
||||||
return NewSimpleStatusOutput(w, formatter, forceKeepANSI)
|
return NewSimpleStatusOutput(w, formatter, forceKeepANSI)
|
||||||
|
Reference in New Issue
Block a user