2017-02-27 16:44:08 -03:00
|
|
|
package task
|
|
|
|
|
|
|
|
|
|
import (
|
2017-07-16 16:15:29 -03:00
|
|
|
"context"
|
2017-09-16 11:44:13 -03:00
|
|
|
"fmt"
|
2017-02-27 16:44:08 -03:00
|
|
|
|
2023-12-29 20:32:03 +00:00
|
|
|
"github.com/go-task/task/v3/taskfile/ast"
|
2017-02-27 16:44:08 -03:00
|
|
|
)
|
|
|
|
|
|
2017-12-26 21:43:52 -02:00
|
|
|
// Status returns an error if any the of given tasks is not up-to-date
|
2025-02-23 18:30:42 +00:00
|
|
|
func (e *Executor) Status(ctx context.Context, calls ...*Call) error {
|
2017-12-26 21:43:52 -02:00
|
|
|
for _, call := range calls {
|
2018-10-06 17:55:23 -03:00
|
|
|
t, err := e.CompiledTask(call)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
2017-12-26 21:43:52 -02:00
|
|
|
}
|
2023-03-10 18:27:30 +00:00
|
|
|
|
2026-08-10 16:12:18 +02:00
|
|
|
isUpToDate, err := e.fingerprinter().UpToDate(ctx, t)
|
2017-12-26 21:43:52 -02:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
if !isUpToDate {
|
2020-06-03 22:19:12 +02:00
|
|
|
return fmt.Errorf(`task: Task "%s" is not up-to-date`, t.Name())
|
2017-12-26 21:43:52 -02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-29 20:32:03 +00:00
|
|
|
func (e *Executor) statusOnError(t *ast.Task) error {
|
2026-08-10 16:12:18 +02:00
|
|
|
return e.fingerprinter().OnError(t)
|
2017-07-16 16:15:29 -03:00
|
|
|
}
|