mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
39
vendor/github.com/moby/buildkit/util/progress/progressui/display.go
generated
vendored
39
vendor/github.com/moby/buildkit/util/progress/progressui/display.go
generated
vendored
@ -21,11 +21,37 @@ import (
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
func DisplaySolveStatus(ctx context.Context, phase string, c console.Console, w io.Writer, ch chan *client.SolveStatus) ([]client.VertexWarning, error) {
|
||||
type displaySolveStatusOpts struct {
|
||||
phase string
|
||||
textDesc string
|
||||
consoleDesc string
|
||||
}
|
||||
|
||||
type DisplaySolveStatusOpt func(b *displaySolveStatusOpts)
|
||||
|
||||
func WithPhase(phase string) DisplaySolveStatusOpt {
|
||||
return func(b *displaySolveStatusOpts) {
|
||||
b.phase = phase
|
||||
}
|
||||
}
|
||||
|
||||
func WithDesc(text string, console string) DisplaySolveStatusOpt {
|
||||
return func(b *displaySolveStatusOpts) {
|
||||
b.textDesc = text
|
||||
b.consoleDesc = console
|
||||
}
|
||||
}
|
||||
|
||||
func DisplaySolveStatus(ctx context.Context, c console.Console, w io.Writer, ch chan *client.SolveStatus, opts ...DisplaySolveStatusOpt) ([]client.VertexWarning, error) {
|
||||
modeConsole := c != nil
|
||||
|
||||
disp := &display{c: c, phase: phase}
|
||||
printer := &textMux{w: w}
|
||||
dsso := &displaySolveStatusOpts{}
|
||||
for _, opt := range opts {
|
||||
opt(dsso)
|
||||
}
|
||||
|
||||
disp := &display{c: c, phase: dsso.phase, desc: dsso.consoleDesc}
|
||||
printer := &textMux{w: w, desc: dsso.textDesc}
|
||||
|
||||
if disp.phase == "" {
|
||||
disp.phase = "Building"
|
||||
@ -711,6 +737,7 @@ func addTime(tm *time.Time, d time.Duration) *time.Time {
|
||||
type display struct {
|
||||
c console.Console
|
||||
phase string
|
||||
desc string
|
||||
lineCount int
|
||||
repeated bool
|
||||
}
|
||||
@ -784,7 +811,11 @@ func (disp *display) print(d displayInfo, width, height int, all bool) {
|
||||
defer fmt.Fprint(disp.c, aec.Show)
|
||||
|
||||
out := fmt.Sprintf("[+] %s %.1fs (%d/%d) %s", disp.phase, time.Since(d.startTime).Seconds(), d.countCompleted, d.countTotal, statusStr)
|
||||
out = align(out, "", width)
|
||||
if disp.desc != "" {
|
||||
out = align(out, disp.desc, width-1)
|
||||
} else {
|
||||
out = align(out, "", width)
|
||||
}
|
||||
fmt.Fprintln(disp.c, out)
|
||||
lineCount := 0
|
||||
for _, j := range d.jobs {
|
||||
|
2
vendor/github.com/moby/buildkit/util/progress/progressui/init.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/progress/progressui/init.go
generated
vendored
@ -14,7 +14,7 @@ var colorError aec.ANSI
|
||||
|
||||
func init() {
|
||||
// As recommended on https://no-color.org/
|
||||
if _, ok := os.LookupEnv("NO_COLOR"); ok {
|
||||
if v := os.Getenv("NO_COLOR"); v != "" {
|
||||
// nil values will result in no ANSI color codes being emitted.
|
||||
return
|
||||
} else if runtime.GOOS == "windows" {
|
||||
|
4
vendor/github.com/moby/buildkit/util/progress/progressui/printer.go
generated
vendored
4
vendor/github.com/moby/buildkit/util/progress/progressui/printer.go
generated
vendored
@ -32,6 +32,7 @@ type textMux struct {
|
||||
last map[string]lastStatus
|
||||
notFirst bool
|
||||
nextIndex int
|
||||
desc string
|
||||
}
|
||||
|
||||
func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
|
||||
@ -63,6 +64,9 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
|
||||
if p.notFirst {
|
||||
fmt.Fprintln(p.w, "")
|
||||
} else {
|
||||
if p.desc != "" {
|
||||
fmt.Fprintf(p.w, "#0 %s\n\n", p.desc)
|
||||
}
|
||||
p.notFirst = true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user