Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/status/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
data, _ := os.ReadFile(checksumFile)
oldMd5 := strings.TrimSpace(string(data))

sources, err := globs(c.TaskDir, c.Sources)
sources, err := Globs(c.TaskDir, c.Sources)
if err != nil {
return false, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/status/glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/go-task/task/v3/internal/filepathext"
)

func globs(dir string, globs []string) ([]string, error) {
func Globs(dir string, globs []string) ([]string, error) {
files := make([]string, 0)
for _, g := range globs {
f, err := Glob(dir, g)
Expand Down
6 changes: 3 additions & 3 deletions internal/status/timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ func (t *Timestamp) IsUpToDate() (bool, error) {
return false, nil
}

sources, err := globs(t.Dir, t.Sources)
sources, err := Globs(t.Dir, t.Sources)
if err != nil {
return false, nil
}
generates, err := globs(t.Dir, t.Generates)
generates, err := Globs(t.Dir, t.Generates)
if err != nil {
return false, nil
}
Expand All @@ -47,7 +47,7 @@ func (t *Timestamp) Kind() string {

// Value implements the Checker Interface
func (t *Timestamp) Value() (interface{}, error) {
sources, err := globs(t.Dir, t.Sources)
sources, err := Globs(t.Dir, t.Sources)
if err != nil {
return time.Now(), err
}
Expand Down
18 changes: 18 additions & 0 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package task
import (
"context"
"fmt"
"strings"

"github.com/go-task/task/v3/internal/execext"
"github.com/go-task/task/v3/internal/logger"
Expand Down Expand Up @@ -48,6 +49,9 @@ func (e *Executor) isTaskUpToDate(ctx context.Context, t *taskfile.Task) (bool,
if err != nil {
return false, err
}

logInputsGenerates(e, t)

isUpToDate, err := checker.IsUpToDate()
if err != nil {
return false, err
Expand All @@ -60,6 +64,20 @@ func (e *Executor) isTaskUpToDate(ctx context.Context, t *taskfile.Task) (bool,
return true, nil
}

// print the sources and generates that are checked if verbose
func logInputsGenerates(e *Executor, t *taskfile.Task) {
if e.Logger.Verbose {
sources, err := status.Globs(t.Dir, t.Sources)
if err == nil {
e.Logger.VerboseOutf(logger.Cyan, "task: sources: [\"%s\"]\n", strings.Join(sources, `", "`))
}
generates, err := status.Globs(t.Dir, t.Generates)
if err == nil {
e.Logger.VerboseOutf(logger.Cyan, "task: generates: [\"%s\"]\n", strings.Join(generates, `", "`))
}
}
}

func (e *Executor) statusOnError(t *taskfile.Task) error {
checker, err := e.getStatusChecker(t)
if err != nil {
Expand Down