build: rework build package to use only a single Build call

Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
Justin Chadwell
2023-04-19 11:54:02 +01:00
parent c6a78d216c
commit 1571c137bc
16 changed files with 1206 additions and 1014 deletions

View File

@@ -42,7 +42,7 @@ func WithDesc(text string, console string) DisplaySolveStatusOpt {
}
}
func DisplaySolveStatus(ctx context.Context, c console.Console, w io.Writer, ch chan *client.SolveStatus, opts ...DisplaySolveStatusOpt) ([]client.VertexWarning, error) {
func DisplaySolveStatus(ctx context.Context, c console.Console, w io.Writer, ch chan *client.SolveStatus, paused *bool, opts ...DisplaySolveStatusOpt) ([]client.VertexWarning, error) {
modeConsole := c != nil
dsso := &displaySolveStatusOpts{}
@@ -78,6 +78,11 @@ func DisplaySolveStatus(ctx context.Context, c console.Console, w io.Writer, ch
displayLimiter := rate.NewLimiter(rate.Every(displayTimeout), 1)
ispaused := false
if paused != nil {
ispaused = *paused
}
var height int
width, _ := disp.getSize()
for {
@@ -93,6 +98,10 @@ func DisplaySolveStatus(ctx context.Context, c console.Console, w io.Writer, ch
}
}
if paused != nil && *paused && ispaused {
continue
}
if modeConsole {
width, height = disp.getSize()
if done {
@@ -115,6 +124,10 @@ func DisplaySolveStatus(ctx context.Context, c console.Console, w io.Writer, ch
ticker = time.NewTicker(tickerTimeout)
}
}
if paused != nil {
ispaused = *paused
}
}
}

View File

@@ -87,7 +87,7 @@ func NewPrinter(ctx context.Context, out console.File, mode string) (Writer, err
go func() {
// not using shared context to not disrupt display but let is finish reporting errors
_, pw.err = progressui.DisplaySolveStatus(ctx, c, out, statusCh)
_, pw.err = progressui.DisplaySolveStatus(ctx, c, out, statusCh, nil)
close(doneCh)
}()
return pw, nil