mirror of
				https://github.com/go-task/task.git
				synced 2025-10-30 23:58:01 +02:00 
			
		
		
		
	refactor: taskfile/ast package (#1450)
* refactor: ast package * feat: read -> taskfile * refactor: taskfile.Taskfile -> taskfile.Read * refactor: move merge function back into taskfile package * refactor: rename taskfile.go to read.go
This commit is contained in:
		
							
								
								
									
										12
									
								
								args/args.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								args/args.go
									
									
									
									
									
								
							| @@ -3,22 +3,22 @@ package args | ||||
| import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // Parse parses command line argument: tasks and global variables | ||||
| func Parse(args ...string) ([]taskfile.Call, *taskfile.Vars) { | ||||
| 	calls := []taskfile.Call{} | ||||
| 	globals := &taskfile.Vars{} | ||||
| func Parse(args ...string) ([]ast.Call, *ast.Vars) { | ||||
| 	calls := []ast.Call{} | ||||
| 	globals := &ast.Vars{} | ||||
|  | ||||
| 	for _, arg := range args { | ||||
| 		if !strings.Contains(arg, "=") { | ||||
| 			calls = append(calls, taskfile.Call{Task: arg, Direct: true}) | ||||
| 			calls = append(calls, ast.Call{Task: arg, Direct: true}) | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		name, value := splitVar(arg) | ||||
| 		globals.Set(name, taskfile.Var{Value: value}) | ||||
| 		globals.Set(name, ast.Var{Value: value}) | ||||
| 	} | ||||
|  | ||||
| 	return calls, globals | ||||
|   | ||||
| @@ -8,18 +8,18 @@ import ( | ||||
|  | ||||
| 	"github.com/go-task/task/v3/args" | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func TestArgs(t *testing.T) { | ||||
| 	tests := []struct { | ||||
| 		Args            []string | ||||
| 		ExpectedCalls   []taskfile.Call | ||||
| 		ExpectedGlobals *taskfile.Vars | ||||
| 		ExpectedCalls   []ast.Call | ||||
| 		ExpectedGlobals *ast.Vars | ||||
| 	}{ | ||||
| 		{ | ||||
| 			Args: []string{"task-a", "task-b", "task-c"}, | ||||
| 			ExpectedCalls: []taskfile.Call{ | ||||
| 			ExpectedCalls: []ast.Call{ | ||||
| 				{Task: "task-a", Direct: true}, | ||||
| 				{Task: "task-b", Direct: true}, | ||||
| 				{Task: "task-c", Direct: true}, | ||||
| @@ -27,14 +27,14 @@ func TestArgs(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			Args: []string{"task-a", "FOO=bar", "task-b", "task-c", "BAR=baz", "BAZ=foo"}, | ||||
| 			ExpectedCalls: []taskfile.Call{ | ||||
| 			ExpectedCalls: []ast.Call{ | ||||
| 				{Task: "task-a", Direct: true}, | ||||
| 				{Task: "task-b", Direct: true}, | ||||
| 				{Task: "task-c", Direct: true}, | ||||
| 			}, | ||||
| 			ExpectedGlobals: &taskfile.Vars{ | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					map[string]taskfile.Var{ | ||||
| 					map[string]ast.Var{ | ||||
| 						"FOO": {Value: "bar"}, | ||||
| 						"BAR": {Value: "baz"}, | ||||
| 						"BAZ": {Value: "foo"}, | ||||
| @@ -45,12 +45,12 @@ func TestArgs(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			Args: []string{"task-a", "CONTENT=with some spaces"}, | ||||
| 			ExpectedCalls: []taskfile.Call{ | ||||
| 			ExpectedCalls: []ast.Call{ | ||||
| 				{Task: "task-a", Direct: true}, | ||||
| 			}, | ||||
| 			ExpectedGlobals: &taskfile.Vars{ | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					map[string]taskfile.Var{ | ||||
| 					map[string]ast.Var{ | ||||
| 						"CONTENT": {Value: "with some spaces"}, | ||||
| 					}, | ||||
| 					[]string{"CONTENT"}, | ||||
| @@ -59,13 +59,13 @@ func TestArgs(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			Args: []string{"FOO=bar", "task-a", "task-b"}, | ||||
| 			ExpectedCalls: []taskfile.Call{ | ||||
| 			ExpectedCalls: []ast.Call{ | ||||
| 				{Task: "task-a", Direct: true}, | ||||
| 				{Task: "task-b", Direct: true}, | ||||
| 			}, | ||||
| 			ExpectedGlobals: &taskfile.Vars{ | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					map[string]taskfile.Var{ | ||||
| 					map[string]ast.Var{ | ||||
| 						"FOO": {Value: "bar"}, | ||||
| 					}, | ||||
| 					[]string{"FOO"}, | ||||
| @@ -74,18 +74,18 @@ func TestArgs(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			Args:          nil, | ||||
| 			ExpectedCalls: []taskfile.Call{}, | ||||
| 			ExpectedCalls: []ast.Call{}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			Args:          []string{}, | ||||
| 			ExpectedCalls: []taskfile.Call{}, | ||||
| 			ExpectedCalls: []ast.Call{}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			Args:          []string{"FOO=bar", "BAR=baz"}, | ||||
| 			ExpectedCalls: []taskfile.Call{}, | ||||
| 			ExpectedGlobals: &taskfile.Vars{ | ||||
| 			ExpectedCalls: []ast.Call{}, | ||||
| 			ExpectedGlobals: &ast.Vars{ | ||||
| 				OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 					map[string]taskfile.Var{ | ||||
| 					map[string]ast.Var{ | ||||
| 						"FOO": {Value: "bar"}, | ||||
| 						"BAR": {Value: "baz"}, | ||||
| 					}, | ||||
|   | ||||
| @@ -19,7 +19,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/internal/sort" | ||||
| 	ver "github.com/go-task/task/v3/internal/version" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| const usage = `Usage: task [flags...] [task...] | ||||
| @@ -68,7 +68,7 @@ var flags struct { | ||||
| 	concurrency int | ||||
| 	dir         string | ||||
| 	entrypoint  string | ||||
| 	output      taskfile.Output | ||||
| 	output      ast.Output | ||||
| 	color       bool | ||||
| 	interval    time.Duration | ||||
| 	global      bool | ||||
| @@ -291,8 +291,8 @@ func run() error { | ||||
| 	} | ||||
|  | ||||
| 	var ( | ||||
| 		calls   []taskfile.Call | ||||
| 		globals *taskfile.Vars | ||||
| 		calls   []ast.Call | ||||
| 		globals *ast.Vars | ||||
| 	) | ||||
|  | ||||
| 	tasksAndVars, cliArgs, err := getArgs() | ||||
| @@ -304,11 +304,11 @@ func run() error { | ||||
|  | ||||
| 	// If there are no calls, run the default task instead | ||||
| 	if len(calls) == 0 { | ||||
| 		calls = append(calls, taskfile.Call{Task: "default", Direct: true}) | ||||
| 		calls = append(calls, ast.Call{Task: "default", Direct: true}) | ||||
| 	} | ||||
|  | ||||
| 	globals.Set("CLI_ARGS", taskfile.Var{Value: cliArgs}) | ||||
| 	globals.Set("CLI_FORCE", taskfile.Var{Value: flags.force || flags.forceAll}) | ||||
| 	globals.Set("CLI_ARGS", ast.Var{Value: cliArgs}) | ||||
| 	globals.Set("CLI_FORCE", ast.Var{Value: flags.force || flags.forceAll}) | ||||
| 	e.Taskfile.Vars.Merge(globals) | ||||
|  | ||||
| 	if !flags.watch { | ||||
|   | ||||
							
								
								
									
										4
									
								
								hash.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hash.go
									
									
									
									
									
								
							| @@ -4,10 +4,10 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/hash" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func (e *Executor) GetHash(t *taskfile.Task) (string, error) { | ||||
| func (e *Executor) GetHash(t *ast.Task) (string, error) { | ||||
| 	r := t.Run | ||||
| 	if r == "" { | ||||
| 		r = e.Taskfile.Run | ||||
|   | ||||
							
								
								
									
										6
									
								
								help.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								help.go
									
									
									
									
									
								
							| @@ -16,7 +16,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/fingerprint" | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/internal/sort" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // ListOptions collects list-related options | ||||
| @@ -57,7 +57,7 @@ func (o ListOptions) Validate() error { | ||||
| } | ||||
|  | ||||
| // Filters returns the slice of FilterFunc which filters a list | ||||
| // of taskfile.Task according to the given ListOptions | ||||
| // of ast.Task according to the given ListOptions | ||||
| func (o ListOptions) Filters() []FilterFunc { | ||||
| 	filters := []FilterFunc{FilterOutInternal} | ||||
|  | ||||
| @@ -159,7 +159,7 @@ func (e *Executor) ListTaskNames(allTasks bool) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (e *Executor) ToEditorOutput(tasks []*taskfile.Task, noStatus bool) (*editors.Taskfile, error) { | ||||
| func (e *Executor) ToEditorOutput(tasks []*ast.Task, noStatus bool) (*editors.Taskfile, error) { | ||||
| 	o := &editors.Taskfile{ | ||||
| 		Tasks:    make([]editors.Task, len(tasks)), | ||||
| 		Location: e.Taskfile.Location, | ||||
|   | ||||
| @@ -12,15 +12,15 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/internal/version" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| type Compiler struct { | ||||
| 	Dir            string | ||||
| 	UserWorkingDir string | ||||
|  | ||||
| 	TaskfileEnv  *taskfile.Vars | ||||
| 	TaskfileVars *taskfile.Vars | ||||
| 	TaskfileEnv  *ast.Vars | ||||
| 	TaskfileVars *ast.Vars | ||||
|  | ||||
| 	Logger *logger.Logger | ||||
|  | ||||
| @@ -28,19 +28,19 @@ type Compiler struct { | ||||
| 	muDynamicCache sync.Mutex | ||||
| } | ||||
|  | ||||
| func (c *Compiler) GetTaskfileVariables() (*taskfile.Vars, error) { | ||||
| func (c *Compiler) GetTaskfileVariables() (*ast.Vars, error) { | ||||
| 	return c.getVariables(nil, nil, true) | ||||
| } | ||||
|  | ||||
| func (c *Compiler) GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) { | ||||
| func (c *Compiler) GetVariables(t *ast.Task, call ast.Call) (*ast.Vars, error) { | ||||
| 	return c.getVariables(t, &call, true) | ||||
| } | ||||
|  | ||||
| func (c *Compiler) FastGetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) { | ||||
| func (c *Compiler) FastGetVariables(t *ast.Task, call ast.Call) (*ast.Vars, error) { | ||||
| 	return c.getVariables(t, &call, false) | ||||
| } | ||||
|  | ||||
| func (c *Compiler) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateShVars bool) (*taskfile.Vars, error) { | ||||
| func (c *Compiler) getVariables(t *ast.Task, call *ast.Call, evaluateShVars bool) (*ast.Vars, error) { | ||||
| 	result := GetEnviron() | ||||
| 	if t != nil { | ||||
| 		specialVars, err := c.getSpecialVars(t) | ||||
| @@ -48,15 +48,15 @@ func (c *Compiler) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateS | ||||
| 			return nil, err | ||||
| 		} | ||||
| 		for k, v := range specialVars { | ||||
| 			result.Set(k, taskfile.Var{Value: v}) | ||||
| 			result.Set(k, ast.Var{Value: v}) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	getRangeFunc := func(dir string) func(k string, v taskfile.Var) error { | ||||
| 		return func(k string, v taskfile.Var) error { | ||||
| 	getRangeFunc := func(dir string) func(k string, v ast.Var) error { | ||||
| 		return func(k string, v ast.Var) error { | ||||
| 			tr := templater.Templater{Vars: result} | ||||
| 			// Replace values | ||||
| 			newVar := taskfile.Var{} | ||||
| 			newVar := ast.Var{} | ||||
| 			switch value := v.Value.(type) { | ||||
| 			case string: | ||||
| 				newVar.Value = tr.Replace(value) | ||||
| @@ -68,12 +68,12 @@ func (c *Compiler) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateS | ||||
| 			// If the variable should not be evaluated, but is nil, set it to an empty string | ||||
| 			// This stops empty interface errors when using the templater to replace values later | ||||
| 			if !evaluateShVars && newVar.Value == nil { | ||||
| 				result.Set(k, taskfile.Var{Value: ""}) | ||||
| 				result.Set(k, ast.Var{Value: ""}) | ||||
| 				return nil | ||||
| 			} | ||||
| 			// If the variable should not be evaluated and it is set, we can set it and return | ||||
| 			if !evaluateShVars { | ||||
| 				result.Set(k, taskfile.Var{Value: newVar.Value}) | ||||
| 				result.Set(k, ast.Var{Value: newVar.Value}) | ||||
| 				return nil | ||||
| 			} | ||||
| 			// Now we can check for errors since we've handled all the cases when we don't want to evaluate | ||||
| @@ -82,7 +82,7 @@ func (c *Compiler) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateS | ||||
| 			} | ||||
| 			// If the variable is not dynamic, we can set it and return | ||||
| 			if newVar.Value != nil || newVar.Sh == "" { | ||||
| 				result.Set(k, taskfile.Var{Value: newVar.Value}) | ||||
| 				result.Set(k, ast.Var{Value: newVar.Value}) | ||||
| 				return nil | ||||
| 			} | ||||
| 			// If the variable is dynamic, we need to resolve it first | ||||
| @@ -90,13 +90,13 @@ func (c *Compiler) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateS | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 			result.Set(k, taskfile.Var{Value: static}) | ||||
| 			result.Set(k, ast.Var{Value: static}) | ||||
| 			return nil | ||||
| 		} | ||||
| 	} | ||||
| 	rangeFunc := getRangeFunc(c.Dir) | ||||
|  | ||||
| 	var taskRangeFunc func(k string, v taskfile.Var) error | ||||
| 	var taskRangeFunc func(k string, v ast.Var) error | ||||
| 	if t != nil { | ||||
| 		// NOTE(@andreynering): We're manually joining these paths here because | ||||
| 		// this is the raw task, not the compiled one. | ||||
| @@ -138,7 +138,7 @@ func (c *Compiler) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateS | ||||
| 	return result, nil | ||||
| } | ||||
|  | ||||
| func (c *Compiler) HandleDynamicVar(v taskfile.Var, dir string) (string, error) { | ||||
| func (c *Compiler) HandleDynamicVar(v ast.Var, dir string) (string, error) { | ||||
| 	c.muDynamicCache.Lock() | ||||
| 	defer c.muDynamicCache.Unlock() | ||||
|  | ||||
| @@ -184,7 +184,7 @@ func (c *Compiler) ResetCache() { | ||||
| 	c.dynamicCache = nil | ||||
| } | ||||
|  | ||||
| func (c *Compiler) getSpecialVars(t *taskfile.Task) (map[string]string, error) { | ||||
| func (c *Compiler) getSpecialVars(t *ast.Task) (map[string]string, error) { | ||||
| 	taskfileDir, err := c.getTaskfileDir(t) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| @@ -199,7 +199,7 @@ func (c *Compiler) getSpecialVars(t *taskfile.Task) (map[string]string, error) { | ||||
| 	}, nil | ||||
| } | ||||
|  | ||||
| func (c *Compiler) getTaskfileDir(t *taskfile.Task) (string, error) { | ||||
| func (c *Compiler) getTaskfileDir(t *ast.Task) (string, error) { | ||||
| 	if t.IncludedTaskfile != nil { | ||||
| 		return t.IncludedTaskfile.FullDirPath() | ||||
| 	} | ||||
|   | ||||
| @@ -4,17 +4,17 @@ import ( | ||||
| 	"os" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // GetEnviron the all return all environment variables encapsulated on a | ||||
| // taskfile.Vars | ||||
| func GetEnviron() *taskfile.Vars { | ||||
| 	m := &taskfile.Vars{} | ||||
| // ast.Vars | ||||
| func GetEnviron() *ast.Vars { | ||||
| 	m := &ast.Vars{} | ||||
| 	for _, e := range os.Environ() { | ||||
| 		keyVal := strings.SplitN(e, "=", 2) | ||||
| 		key, val := keyVal[0], keyVal[1] | ||||
| 		m.Set(key, taskfile.Var{Value: val}) | ||||
| 		m.Set(key, ast.Var{Value: val}) | ||||
| 	} | ||||
| 	return m | ||||
| } | ||||
|   | ||||
							
								
								
									
										4
									
								
								internal/env/env.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								internal/env/env.go
									
									
									
									
										vendored
									
									
								
							| @@ -4,10 +4,10 @@ import ( | ||||
| 	"fmt" | ||||
| 	"os" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func Get(t *taskfile.Task) []string { | ||||
| func Get(t *ast.Task) []string { | ||||
| 	if t.Env == nil { | ||||
| 		return nil | ||||
| 	} | ||||
|   | ||||
| @@ -3,18 +3,18 @@ package fingerprint | ||||
| import ( | ||||
| 	"context" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // StatusCheckable defines any type that can check if the status of a task is up-to-date. | ||||
| type StatusCheckable interface { | ||||
| 	IsUpToDate(ctx context.Context, t *taskfile.Task) (bool, error) | ||||
| 	IsUpToDate(ctx context.Context, t *ast.Task) (bool, error) | ||||
| } | ||||
|  | ||||
| // SourcesCheckable defines any type that can check if the sources of a task are up-to-date. | ||||
| type SourcesCheckable interface { | ||||
| 	IsUpToDate(t *taskfile.Task) (bool, error) | ||||
| 	Value(t *taskfile.Task) (any, error) | ||||
| 	OnError(t *taskfile.Task) error | ||||
| 	IsUpToDate(t *ast.Task) (bool, error) | ||||
| 	Value(t *ast.Task) (any, error) | ||||
| 	OnError(t *ast.Task) error | ||||
| 	Kind() string | ||||
| } | ||||
|   | ||||
| @@ -8,10 +8,10 @@ import ( | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/execext" | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func Globs(dir string, globs []*taskfile.Glob) ([]string, error) { | ||||
| func Globs(dir string, globs []*ast.Glob) ([]string, error) { | ||||
| 	fileMap := make(map[string]bool) | ||||
| 	for _, g := range globs { | ||||
| 		matches, err := Glob(dir, g.Glob) | ||||
|   | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| 	"github.com/zeebo/xxh3" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // ChecksumChecker validates if a task is up to date by calculating its source | ||||
| @@ -28,7 +28,7 @@ func NewChecksumChecker(tempDir string, dry bool) *ChecksumChecker { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (checker *ChecksumChecker) IsUpToDate(t *taskfile.Task) (bool, error) { | ||||
| func (checker *ChecksumChecker) IsUpToDate(t *ast.Task) (bool, error) { | ||||
| 	if len(t.Sources) == 0 { | ||||
| 		return false, nil | ||||
| 	} | ||||
| @@ -72,11 +72,11 @@ func (checker *ChecksumChecker) IsUpToDate(t *taskfile.Task) (bool, error) { | ||||
| 	return oldHash == newHash, nil | ||||
| } | ||||
|  | ||||
| func (checker *ChecksumChecker) Value(t *taskfile.Task) (any, error) { | ||||
| func (checker *ChecksumChecker) Value(t *ast.Task) (any, error) { | ||||
| 	return checker.checksum(t) | ||||
| } | ||||
|  | ||||
| func (checker *ChecksumChecker) OnError(t *taskfile.Task) error { | ||||
| func (checker *ChecksumChecker) OnError(t *ast.Task) error { | ||||
| 	if len(t.Sources) == 0 { | ||||
| 		return nil | ||||
| 	} | ||||
| @@ -87,7 +87,7 @@ func (*ChecksumChecker) Kind() string { | ||||
| 	return "checksum" | ||||
| } | ||||
|  | ||||
| func (c *ChecksumChecker) checksum(t *taskfile.Task) (string, error) { | ||||
| func (c *ChecksumChecker) checksum(t *ast.Task) (string, error) { | ||||
| 	sources, err := Globs(t.Dir, t.Sources) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| @@ -114,7 +114,7 @@ func (c *ChecksumChecker) checksum(t *taskfile.Task) (string, error) { | ||||
| 	return fmt.Sprintf("%x%x", hash.Hi, hash.Lo), nil | ||||
| } | ||||
|  | ||||
| func (checker *ChecksumChecker) checksumFilePath(t *taskfile.Task) string { | ||||
| func (checker *ChecksumChecker) checksumFilePath(t *ast.Task) string { | ||||
| 	return filepath.Join(checker.tempDir, "checksum", normalizeFilename(t.Name())) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,20 +1,20 @@ | ||||
| package fingerprint | ||||
|  | ||||
| import "github.com/go-task/task/v3/taskfile" | ||||
| import "github.com/go-task/task/v3/taskfile/ast" | ||||
|  | ||||
| // NoneChecker is a no-op Checker. | ||||
| // It will always report that the task is not up-to-date. | ||||
| type NoneChecker struct{} | ||||
|  | ||||
| func (NoneChecker) IsUpToDate(t *taskfile.Task) (bool, error) { | ||||
| func (NoneChecker) IsUpToDate(t *ast.Task) (bool, error) { | ||||
| 	return false, nil | ||||
| } | ||||
|  | ||||
| func (NoneChecker) Value(t *taskfile.Task) (any, error) { | ||||
| func (NoneChecker) Value(t *ast.Task) (any, error) { | ||||
| 	return "", nil | ||||
| } | ||||
|  | ||||
| func (NoneChecker) OnError(t *taskfile.Task) error { | ||||
| func (NoneChecker) OnError(t *ast.Task) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import ( | ||||
| 	"path/filepath" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // TimestampChecker checks if any source change compared with the generated files, | ||||
| @@ -23,7 +23,7 @@ func NewTimestampChecker(tempDir string, dry bool) *TimestampChecker { | ||||
| } | ||||
|  | ||||
| // IsUpToDate implements the Checker interface | ||||
| func (checker *TimestampChecker) IsUpToDate(t *taskfile.Task) (bool, error) { | ||||
| func (checker *TimestampChecker) IsUpToDate(t *ast.Task) (bool, error) { | ||||
| 	if len(t.Sources) == 0 { | ||||
| 		return false, nil | ||||
| 	} | ||||
| @@ -89,7 +89,7 @@ func (checker *TimestampChecker) Kind() string { | ||||
| } | ||||
|  | ||||
| // Value implements the Checker Interface | ||||
| func (checker *TimestampChecker) Value(t *taskfile.Task) (any, error) { | ||||
| func (checker *TimestampChecker) Value(t *ast.Task) (any, error) { | ||||
| 	sources, err := Globs(t.Dir, t.Sources) | ||||
| 	if err != nil { | ||||
| 		return time.Now(), err | ||||
| @@ -142,10 +142,10 @@ func anyFileNewerThan(files []string, givenTime time.Time) (bool, error) { | ||||
| } | ||||
|  | ||||
| // OnError implements the Checker interface | ||||
| func (*TimestampChecker) OnError(t *taskfile.Task) error { | ||||
| func (*TimestampChecker) OnError(t *ast.Task) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (checker *TimestampChecker) timestampFilePath(t *taskfile.Task) string { | ||||
| func (checker *TimestampChecker) timestampFilePath(t *ast.Task) string { | ||||
| 	return filepath.Join(checker.tempDir, "timestamp", normalizeFilename(t.Task)) | ||||
| } | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/env" | ||||
| 	"github.com/go-task/task/v3/internal/execext" | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| type StatusChecker struct { | ||||
| @@ -19,7 +19,7 @@ func NewStatusChecker(logger *logger.Logger) StatusCheckable { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (checker *StatusChecker) IsUpToDate(ctx context.Context, t *taskfile.Task) (bool, error) { | ||||
| func (checker *StatusChecker) IsUpToDate(ctx context.Context, t *ast.Task) (bool, error) { | ||||
| 	for _, s := range t.Status { | ||||
| 		err := execext.RunCommand(ctx, &execext.RunCommandOptions{ | ||||
| 			Command: s, | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import ( | ||||
| 	"context" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| type ( | ||||
| @@ -57,7 +57,7 @@ func WithSourcesChecker(checker SourcesCheckable) CheckerOption { | ||||
|  | ||||
| func IsTaskUpToDate( | ||||
| 	ctx context.Context, | ||||
| 	t *taskfile.Task, | ||||
| 	t *ast.Task, | ||||
| 	opts ...CheckerOption, | ||||
| ) (bool, error) { | ||||
| 	var statusUpToDate bool | ||||
|   | ||||
| @@ -9,7 +9,7 @@ import ( | ||||
| 	"github.com/stretchr/testify/require" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/mocks" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // TruthTable | ||||
| @@ -28,14 +28,14 @@ import ( | ||||
| func TestIsTaskUpToDate(t *testing.T) { | ||||
| 	tests := []struct { | ||||
| 		name                    string | ||||
| 		task                    *taskfile.Task | ||||
| 		task                    *ast.Task | ||||
| 		setupMockStatusChecker  func(m *mocks.StatusCheckable) | ||||
| 		setupMockSourcesChecker func(m *mocks.SourcesCheckable) | ||||
| 		expected                bool | ||||
| 	}{ | ||||
| 		{ | ||||
| 			name: "expect FALSE when no status or sources are defined", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  nil, | ||||
| 				Sources: nil, | ||||
| 			}, | ||||
| @@ -45,9 +45,9 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect TRUE when no status is defined and sources are up-to-date", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  nil, | ||||
| 				Sources: []*taskfile.Glob{{Glob: "sources"}}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: nil, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| @@ -57,9 +57,9 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect FALSE when no status is defined and sources are NOT up-to-date", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  nil, | ||||
| 				Sources: []*taskfile.Glob{{Glob: "sources"}}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: nil, | ||||
| 			setupMockSourcesChecker: func(m *mocks.SourcesCheckable) { | ||||
| @@ -69,7 +69,7 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect TRUE when status is up-to-date and sources are not defined", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: nil, | ||||
| 			}, | ||||
| @@ -81,9 +81,9 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect TRUE when status and sources are up-to-date", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*taskfile.Glob{{Glob: "sources"}}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil) | ||||
| @@ -95,9 +95,9 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect FALSE when status is up-to-date, but sources are NOT up-to-date", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*taskfile.Glob{{Glob: "sources"}}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(true, nil) | ||||
| @@ -109,7 +109,7 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect FALSE when status is NOT up-to-date and sources are not defined", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: nil, | ||||
| 			}, | ||||
| @@ -121,9 +121,9 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect FALSE when status is NOT up-to-date, but sources are up-to-date", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*taskfile.Glob{{Glob: "sources"}}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil) | ||||
| @@ -135,9 +135,9 @@ func TestIsTaskUpToDate(t *testing.T) { | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "expect FALSE when status and sources are NOT up-to-date", | ||||
| 			task: &taskfile.Task{ | ||||
| 			task: &ast.Task{ | ||||
| 				Status:  []string{"status"}, | ||||
| 				Sources: []*taskfile.Glob{{Glob: "sources"}}, | ||||
| 				Sources: []*ast.Glob{{Glob: "sources"}}, | ||||
| 			}, | ||||
| 			setupMockStatusChecker: func(m *mocks.StatusCheckable) { | ||||
| 				m.EXPECT().IsUpToDate(mock.Anything, mock.Anything).Return(false, nil) | ||||
|   | ||||
| @@ -5,20 +5,20 @@ import ( | ||||
|  | ||||
| 	"github.com/mitchellh/hashstructure/v2" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| type HashFunc func(*taskfile.Task) (string, error) | ||||
| type HashFunc func(*ast.Task) (string, error) | ||||
|  | ||||
| func Empty(*taskfile.Task) (string, error) { | ||||
| func Empty(*ast.Task) (string, error) { | ||||
| 	return "", nil | ||||
| } | ||||
|  | ||||
| func Name(t *taskfile.Task) (string, error) { | ||||
| func Name(t *ast.Task) (string, error) { | ||||
| 	return t.Task, nil | ||||
| } | ||||
|  | ||||
| func Hash(t *taskfile.Task) (string, error) { | ||||
| func Hash(t *ast.Task) (string, error) { | ||||
| 	h, err := hashstructure.Hash(t, hashstructure.FormatV2, nil) | ||||
| 	return fmt.Sprintf("%s:%d", t.Task, h), err | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,8 @@ | ||||
| package mocks | ||||
|  | ||||
| import ( | ||||
| 	taskfile "github.com/go-task/task/v3/taskfile" | ||||
| 	ast "github.com/go-task/task/v3/taskfile/ast" | ||||
|  | ||||
| 	mock "github.com/stretchr/testify/mock" | ||||
| ) | ||||
|  | ||||
| @@ -21,21 +22,21 @@ func (_m *SourcesCheckable) EXPECT() *SourcesCheckable_Expecter { | ||||
| } | ||||
|  | ||||
| // IsUpToDate provides a mock function with given fields: t | ||||
| func (_m *SourcesCheckable) IsUpToDate(t *taskfile.Task) (bool, error) { | ||||
| func (_m *SourcesCheckable) IsUpToDate(t *ast.Task) (bool, error) { | ||||
| 	ret := _m.Called(t) | ||||
|  | ||||
| 	var r0 bool | ||||
| 	var r1 error | ||||
| 	if rf, ok := ret.Get(0).(func(*taskfile.Task) (bool, error)); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) (bool, error)); ok { | ||||
| 		return rf(t) | ||||
| 	} | ||||
| 	if rf, ok := ret.Get(0).(func(*taskfile.Task) bool); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) bool); ok { | ||||
| 		r0 = rf(t) | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(bool) | ||||
| 	} | ||||
|  | ||||
| 	if rf, ok := ret.Get(1).(func(*taskfile.Task) error); ok { | ||||
| 	if rf, ok := ret.Get(1).(func(*ast.Task) error); ok { | ||||
| 		r1 = rf(t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| @@ -50,14 +51,14 @@ type SourcesCheckable_IsUpToDate_Call struct { | ||||
| } | ||||
|  | ||||
| // IsUpToDate is a helper method to define mock.On call | ||||
| //   - t *taskfile.Task | ||||
| //   - t *ast.Task | ||||
| func (_e *SourcesCheckable_Expecter) IsUpToDate(t interface{}) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	return &SourcesCheckable_IsUpToDate_Call{Call: _e.mock.On("IsUpToDate", t)} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) Run(run func(t *taskfile.Task)) *SourcesCheckable_IsUpToDate_Call { | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) Run(run func(t *ast.Task)) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*taskfile.Task)) | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
| @@ -67,7 +68,7 @@ func (_c *SourcesCheckable_IsUpToDate_Call) Return(_a0 bool, _a1 error) *Sources | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) RunAndReturn(run func(*taskfile.Task) (bool, error)) *SourcesCheckable_IsUpToDate_Call { | ||||
| func (_c *SourcesCheckable_IsUpToDate_Call) RunAndReturn(run func(*ast.Task) (bool, error)) *SourcesCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
| @@ -114,11 +115,11 @@ func (_c *SourcesCheckable_Kind_Call) RunAndReturn(run func() string) *SourcesCh | ||||
| } | ||||
|  | ||||
| // OnError provides a mock function with given fields: t | ||||
| func (_m *SourcesCheckable) OnError(t *taskfile.Task) error { | ||||
| func (_m *SourcesCheckable) OnError(t *ast.Task) error { | ||||
| 	ret := _m.Called(t) | ||||
|  | ||||
| 	var r0 error | ||||
| 	if rf, ok := ret.Get(0).(func(*taskfile.Task) error); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) error); ok { | ||||
| 		r0 = rf(t) | ||||
| 	} else { | ||||
| 		r0 = ret.Error(0) | ||||
| @@ -133,14 +134,14 @@ type SourcesCheckable_OnError_Call struct { | ||||
| } | ||||
|  | ||||
| // OnError is a helper method to define mock.On call | ||||
| //   - t *taskfile.Task | ||||
| //   - t *ast.Task | ||||
| func (_e *SourcesCheckable_Expecter) OnError(t interface{}) *SourcesCheckable_OnError_Call { | ||||
| 	return &SourcesCheckable_OnError_Call{Call: _e.mock.On("OnError", t)} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_OnError_Call) Run(run func(t *taskfile.Task)) *SourcesCheckable_OnError_Call { | ||||
| func (_c *SourcesCheckable_OnError_Call) Run(run func(t *ast.Task)) *SourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*taskfile.Task)) | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
| @@ -150,21 +151,21 @@ func (_c *SourcesCheckable_OnError_Call) Return(_a0 error) *SourcesCheckable_OnE | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_OnError_Call) RunAndReturn(run func(*taskfile.Task) error) *SourcesCheckable_OnError_Call { | ||||
| func (_c *SourcesCheckable_OnError_Call) RunAndReturn(run func(*ast.Task) error) *SourcesCheckable_OnError_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| // Value provides a mock function with given fields: t | ||||
| func (_m *SourcesCheckable) Value(t *taskfile.Task) (interface{}, error) { | ||||
| func (_m *SourcesCheckable) Value(t *ast.Task) (interface{}, error) { | ||||
| 	ret := _m.Called(t) | ||||
|  | ||||
| 	var r0 interface{} | ||||
| 	var r1 error | ||||
| 	if rf, ok := ret.Get(0).(func(*taskfile.Task) (interface{}, error)); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) (interface{}, error)); ok { | ||||
| 		return rf(t) | ||||
| 	} | ||||
| 	if rf, ok := ret.Get(0).(func(*taskfile.Task) interface{}); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(*ast.Task) interface{}); ok { | ||||
| 		r0 = rf(t) | ||||
| 	} else { | ||||
| 		if ret.Get(0) != nil { | ||||
| @@ -172,7 +173,7 @@ func (_m *SourcesCheckable) Value(t *taskfile.Task) (interface{}, error) { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if rf, ok := ret.Get(1).(func(*taskfile.Task) error); ok { | ||||
| 	if rf, ok := ret.Get(1).(func(*ast.Task) error); ok { | ||||
| 		r1 = rf(t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| @@ -187,14 +188,14 @@ type SourcesCheckable_Value_Call struct { | ||||
| } | ||||
|  | ||||
| // Value is a helper method to define mock.On call | ||||
| //   - t *taskfile.Task | ||||
| //   - t *ast.Task | ||||
| func (_e *SourcesCheckable_Expecter) Value(t interface{}) *SourcesCheckable_Value_Call { | ||||
| 	return &SourcesCheckable_Value_Call{Call: _e.mock.On("Value", t)} | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Value_Call) Run(run func(t *taskfile.Task)) *SourcesCheckable_Value_Call { | ||||
| func (_c *SourcesCheckable_Value_Call) Run(run func(t *ast.Task)) *SourcesCheckable_Value_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(*taskfile.Task)) | ||||
| 		run(args[0].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
| @@ -204,7 +205,7 @@ func (_c *SourcesCheckable_Value_Call) Return(_a0 interface{}, _a1 error) *Sourc | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *SourcesCheckable_Value_Call) RunAndReturn(run func(*taskfile.Task) (interface{}, error)) *SourcesCheckable_Value_Call { | ||||
| func (_c *SourcesCheckable_Value_Call) RunAndReturn(run func(*ast.Task) (interface{}, error)) *SourcesCheckable_Value_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|   | ||||
| @@ -5,9 +5,9 @@ package mocks | ||||
| import ( | ||||
| 	context "context" | ||||
|  | ||||
| 	mock "github.com/stretchr/testify/mock" | ||||
| 	ast "github.com/go-task/task/v3/taskfile/ast" | ||||
|  | ||||
| 	taskfile "github.com/go-task/task/v3/taskfile" | ||||
| 	mock "github.com/stretchr/testify/mock" | ||||
| ) | ||||
|  | ||||
| // StatusCheckable is an autogenerated mock type for the StatusCheckable type | ||||
| @@ -24,21 +24,21 @@ func (_m *StatusCheckable) EXPECT() *StatusCheckable_Expecter { | ||||
| } | ||||
|  | ||||
| // IsUpToDate provides a mock function with given fields: ctx, t | ||||
| func (_m *StatusCheckable) IsUpToDate(ctx context.Context, t *taskfile.Task) (bool, error) { | ||||
| func (_m *StatusCheckable) IsUpToDate(ctx context.Context, t *ast.Task) (bool, error) { | ||||
| 	ret := _m.Called(ctx, t) | ||||
|  | ||||
| 	var r0 bool | ||||
| 	var r1 error | ||||
| 	if rf, ok := ret.Get(0).(func(context.Context, *taskfile.Task) (bool, error)); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(context.Context, *ast.Task) (bool, error)); ok { | ||||
| 		return rf(ctx, t) | ||||
| 	} | ||||
| 	if rf, ok := ret.Get(0).(func(context.Context, *taskfile.Task) bool); ok { | ||||
| 	if rf, ok := ret.Get(0).(func(context.Context, *ast.Task) bool); ok { | ||||
| 		r0 = rf(ctx, t) | ||||
| 	} else { | ||||
| 		r0 = ret.Get(0).(bool) | ||||
| 	} | ||||
|  | ||||
| 	if rf, ok := ret.Get(1).(func(context.Context, *taskfile.Task) error); ok { | ||||
| 	if rf, ok := ret.Get(1).(func(context.Context, *ast.Task) error); ok { | ||||
| 		r1 = rf(ctx, t) | ||||
| 	} else { | ||||
| 		r1 = ret.Error(1) | ||||
| @@ -54,14 +54,14 @@ type StatusCheckable_IsUpToDate_Call struct { | ||||
|  | ||||
| // IsUpToDate is a helper method to define mock.On call | ||||
| //   - ctx context.Context | ||||
| //   - t *taskfile.Task | ||||
| //   - t *ast.Task | ||||
| func (_e *StatusCheckable_Expecter) IsUpToDate(ctx interface{}, t interface{}) *StatusCheckable_IsUpToDate_Call { | ||||
| 	return &StatusCheckable_IsUpToDate_Call{Call: _e.mock.On("IsUpToDate", ctx, t)} | ||||
| } | ||||
|  | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) Run(run func(ctx context.Context, t *taskfile.Task)) *StatusCheckable_IsUpToDate_Call { | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) Run(run func(ctx context.Context, t *ast.Task)) *StatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Run(func(args mock.Arguments) { | ||||
| 		run(args[0].(context.Context), args[1].(*taskfile.Task)) | ||||
| 		run(args[0].(context.Context), args[1].(*ast.Task)) | ||||
| 	}) | ||||
| 	return _c | ||||
| } | ||||
| @@ -71,7 +71,7 @@ func (_c *StatusCheckable_IsUpToDate_Call) Return(_a0 bool, _a1 error) *StatusCh | ||||
| 	return _c | ||||
| } | ||||
|  | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) RunAndReturn(run func(context.Context, *taskfile.Task) (bool, error)) *StatusCheckable_IsUpToDate_Call { | ||||
| func (_c *StatusCheckable_IsUpToDate_Call) RunAndReturn(run func(context.Context, *ast.Task) (bool, error)) *StatusCheckable_IsUpToDate_Call { | ||||
| 	_c.Call.Return(run) | ||||
| 	return _c | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import ( | ||||
| 	"fmt" | ||||
| 	"io" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // Templater executes a template engine. | ||||
| @@ -20,8 +20,8 @@ type Output interface { | ||||
|  | ||||
| type CloseFunc func(err error) error | ||||
|  | ||||
| // Build the Output for the requested taskfile.Output. | ||||
| func BuildFor(o *taskfile.Output) (Output, error) { | ||||
| // Build the Output for the requested ast.Output. | ||||
| func BuildFor(o *ast.Output) (Output, error) { | ||||
| 	switch o.Name { | ||||
| 	case "interleaved", "": | ||||
| 		if err := checkOutputGroupUnset(o); err != nil { | ||||
| @@ -44,7 +44,7 @@ func BuildFor(o *taskfile.Output) (Output, error) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func checkOutputGroupUnset(o *taskfile.Output) error { | ||||
| func checkOutputGroupUnset(o *ast.Output) error { | ||||
| 	if o.Group.IsSet() { | ||||
| 		return fmt.Errorf("task: output style %q does not support the group begin/end parameter", o.Name) | ||||
| 	} | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/internal/output" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func TestInterleaved(t *testing.T) { | ||||
| @@ -47,8 +47,8 @@ func TestGroup(t *testing.T) { | ||||
|  | ||||
| func TestGroupWithBeginEnd(t *testing.T) { | ||||
| 	tmpl := templater.Templater{ | ||||
| 		Vars: &taskfile.Vars{ | ||||
| 			OrderedMap: orderedmap.FromMap(map[string]taskfile.Var{ | ||||
| 		Vars: &ast.Vars{ | ||||
| 			OrderedMap: orderedmap.FromMap(map[string]ast.Var{ | ||||
| 				"VAR1": {Value: "example-value"}, | ||||
| 			}), | ||||
| 		}, | ||||
|   | ||||
| @@ -4,22 +4,22 @@ import ( | ||||
| 	"sort" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| type TaskSorter interface { | ||||
| 	Sort([]*taskfile.Task) | ||||
| 	Sort([]*ast.Task) | ||||
| } | ||||
|  | ||||
| type Noop struct{} | ||||
|  | ||||
| func (s *Noop) Sort(tasks []*taskfile.Task) {} | ||||
| func (s *Noop) Sort(tasks []*ast.Task) {} | ||||
|  | ||||
| type AlphaNumeric struct{} | ||||
|  | ||||
| // Tasks that are not namespaced should be listed before tasks that are. | ||||
| // We detect this by searching for a ':' in the task name. | ||||
| func (s *AlphaNumeric) Sort(tasks []*taskfile.Task) { | ||||
| func (s *AlphaNumeric) Sort(tasks []*ast.Task) { | ||||
| 	sort.Slice(tasks, func(i, j int) bool { | ||||
| 		return tasks[i].Task < tasks[j].Task | ||||
| 	}) | ||||
| @@ -29,7 +29,7 @@ type AlphaNumericWithRootTasksFirst struct{} | ||||
|  | ||||
| // Tasks that are not namespaced should be listed before tasks that are. | ||||
| // We detect this by searching for a ':' in the task name. | ||||
| func (s *AlphaNumericWithRootTasksFirst) Sort(tasks []*taskfile.Task) { | ||||
| func (s *AlphaNumericWithRootTasksFirst) Sort(tasks []*ast.Task) { | ||||
| 	sort.Slice(tasks, func(i, j int) bool { | ||||
| 		iContainsColon := strings.Contains(tasks[i].Task, ":") | ||||
| 		jContainsColon := strings.Contains(tasks[j].Task, ":") | ||||
|   | ||||
| @@ -5,36 +5,36 @@ import ( | ||||
|  | ||||
| 	"github.com/stretchr/testify/assert" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func TestAlphaNumericWithRootTasksFirst_Sort(t *testing.T) { | ||||
| 	task1 := &taskfile.Task{Task: "task1"} | ||||
| 	task2 := &taskfile.Task{Task: "task2"} | ||||
| 	task3 := &taskfile.Task{Task: "ns1:task3"} | ||||
| 	task4 := &taskfile.Task{Task: "ns2:task4"} | ||||
| 	task5 := &taskfile.Task{Task: "task5"} | ||||
| 	task6 := &taskfile.Task{Task: "ns3:task6"} | ||||
| 	task1 := &ast.Task{Task: "task1"} | ||||
| 	task2 := &ast.Task{Task: "task2"} | ||||
| 	task3 := &ast.Task{Task: "ns1:task3"} | ||||
| 	task4 := &ast.Task{Task: "ns2:task4"} | ||||
| 	task5 := &ast.Task{Task: "task5"} | ||||
| 	task6 := &ast.Task{Task: "ns3:task6"} | ||||
|  | ||||
| 	tests := []struct { | ||||
| 		name  string | ||||
| 		tasks []*taskfile.Task | ||||
| 		want  []*taskfile.Task | ||||
| 		tasks []*ast.Task | ||||
| 		want  []*ast.Task | ||||
| 	}{ | ||||
| 		{ | ||||
| 			name:  "no namespace tasks sorted alphabetically first", | ||||
| 			tasks: []*taskfile.Task{task3, task2, task1}, | ||||
| 			want:  []*taskfile.Task{task1, task2, task3}, | ||||
| 			tasks: []*ast.Task{task3, task2, task1}, | ||||
| 			want:  []*ast.Task{task1, task2, task3}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:  "namespace tasks sorted alphabetically after non-namespaced tasks", | ||||
| 			tasks: []*taskfile.Task{task3, task4, task5}, | ||||
| 			want:  []*taskfile.Task{task5, task3, task4}, | ||||
| 			tasks: []*ast.Task{task3, task4, task5}, | ||||
| 			want:  []*ast.Task{task5, task3, task4}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:  "all tasks sorted alphabetically with root tasks first", | ||||
| 			tasks: []*taskfile.Task{task6, task5, task4, task3, task2, task1}, | ||||
| 			want:  []*taskfile.Task{task1, task2, task5, task3, task4, task6}, | ||||
| 			tasks: []*ast.Task{task6, task5, task4, task3, task2, task1}, | ||||
| 			want:  []*ast.Task{task1, task2, task5, task3, task4, task6}, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| @@ -48,22 +48,22 @@ func TestAlphaNumericWithRootTasksFirst_Sort(t *testing.T) { | ||||
| } | ||||
|  | ||||
| func TestAlphaNumeric_Sort(t *testing.T) { | ||||
| 	task1 := &taskfile.Task{Task: "task1"} | ||||
| 	task2 := &taskfile.Task{Task: "task2"} | ||||
| 	task3 := &taskfile.Task{Task: "ns1:task3"} | ||||
| 	task4 := &taskfile.Task{Task: "ns2:task4"} | ||||
| 	task5 := &taskfile.Task{Task: "task5"} | ||||
| 	task6 := &taskfile.Task{Task: "ns3:task6"} | ||||
| 	task1 := &ast.Task{Task: "task1"} | ||||
| 	task2 := &ast.Task{Task: "task2"} | ||||
| 	task3 := &ast.Task{Task: "ns1:task3"} | ||||
| 	task4 := &ast.Task{Task: "ns2:task4"} | ||||
| 	task5 := &ast.Task{Task: "task5"} | ||||
| 	task6 := &ast.Task{Task: "ns3:task6"} | ||||
|  | ||||
| 	tests := []struct { | ||||
| 		name  string | ||||
| 		tasks []*taskfile.Task | ||||
| 		want  []*taskfile.Task | ||||
| 		tasks []*ast.Task | ||||
| 		want  []*ast.Task | ||||
| 	}{ | ||||
| 		{ | ||||
| 			name:  "all tasks sorted alphabetically", | ||||
| 			tasks: []*taskfile.Task{task3, task2, task5, task1, task4, task6}, | ||||
| 			want:  []*taskfile.Task{task3, task4, task6, task1, task2, task5}, | ||||
| 			tasks: []*ast.Task{task3, task2, task5, task1, task4, task6}, | ||||
| 			want:  []*ast.Task{task3, task4, task6, task1, task2, task5}, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -4,10 +4,10 @@ import ( | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func PrintTasks(l *logger.Logger, t *taskfile.Taskfile, c []taskfile.Call) { | ||||
| func PrintTasks(l *logger.Logger, t *ast.Taskfile, c []ast.Call) { | ||||
| 	for i, call := range c { | ||||
| 		PrintSpaceBetweenSummaries(l, i) | ||||
| 		PrintTask(l, t.Tasks.Get(call.Task)) | ||||
| @@ -24,7 +24,7 @@ func PrintSpaceBetweenSummaries(l *logger.Logger, i int) { | ||||
| 	l.Outf(logger.Default, "\n") | ||||
| } | ||||
|  | ||||
| func PrintTask(l *logger.Logger, t *taskfile.Task) { | ||||
| func PrintTask(l *logger.Logger, t *ast.Task) { | ||||
| 	printTaskName(l, t) | ||||
| 	printTaskDescribingText(t, l) | ||||
| 	printTaskDependencies(l, t) | ||||
| @@ -32,7 +32,7 @@ func PrintTask(l *logger.Logger, t *taskfile.Task) { | ||||
| 	printTaskCommands(l, t) | ||||
| } | ||||
|  | ||||
| func printTaskDescribingText(t *taskfile.Task, l *logger.Logger) { | ||||
| func printTaskDescribingText(t *ast.Task, l *logger.Logger) { | ||||
| 	if hasSummary(t) { | ||||
| 		printTaskSummary(l, t) | ||||
| 	} else if hasDescription(t) { | ||||
| @@ -42,11 +42,11 @@ func printTaskDescribingText(t *taskfile.Task, l *logger.Logger) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func hasSummary(t *taskfile.Task) bool { | ||||
| func hasSummary(t *ast.Task) bool { | ||||
| 	return t.Summary != "" | ||||
| } | ||||
|  | ||||
| func printTaskSummary(l *logger.Logger, t *taskfile.Task) { | ||||
| func printTaskSummary(l *logger.Logger, t *ast.Task) { | ||||
| 	lines := strings.Split(t.Summary, "\n") | ||||
| 	for i, line := range lines { | ||||
| 		notLastLine := i+1 < len(lines) | ||||
| @@ -56,13 +56,13 @@ func printTaskSummary(l *logger.Logger, t *taskfile.Task) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func printTaskName(l *logger.Logger, t *taskfile.Task) { | ||||
| func printTaskName(l *logger.Logger, t *ast.Task) { | ||||
| 	l.Outf(logger.Default, "task: ") | ||||
| 	l.Outf(logger.Green, "%s\n", t.Name()) | ||||
| 	l.Outf(logger.Default, "\n") | ||||
| } | ||||
|  | ||||
| func printTaskAliases(l *logger.Logger, t *taskfile.Task) { | ||||
| func printTaskAliases(l *logger.Logger, t *ast.Task) { | ||||
| 	if len(t.Aliases) == 0 { | ||||
| 		return | ||||
| 	} | ||||
| @@ -74,11 +74,11 @@ func printTaskAliases(l *logger.Logger, t *taskfile.Task) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func hasDescription(t *taskfile.Task) bool { | ||||
| func hasDescription(t *ast.Task) bool { | ||||
| 	return t.Desc != "" | ||||
| } | ||||
|  | ||||
| func printTaskDescription(l *logger.Logger, t *taskfile.Task) { | ||||
| func printTaskDescription(l *logger.Logger, t *ast.Task) { | ||||
| 	l.Outf(logger.Default, "%s\n", t.Desc) | ||||
| } | ||||
|  | ||||
| @@ -86,7 +86,7 @@ func printNoDescriptionOrSummary(l *logger.Logger) { | ||||
| 	l.Outf(logger.Default, "(task does not have description or summary)\n") | ||||
| } | ||||
|  | ||||
| func printTaskDependencies(l *logger.Logger, t *taskfile.Task) { | ||||
| func printTaskDependencies(l *logger.Logger, t *ast.Task) { | ||||
| 	if len(t.Deps) == 0 { | ||||
| 		return | ||||
| 	} | ||||
| @@ -99,7 +99,7 @@ func printTaskDependencies(l *logger.Logger, t *taskfile.Task) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func printTaskCommands(l *logger.Logger, t *taskfile.Task) { | ||||
| func printTaskCommands(l *logger.Logger, t *ast.Task) { | ||||
| 	if len(t.Cmds) == 0 { | ||||
| 		return | ||||
| 	} | ||||
|   | ||||
| @@ -9,13 +9,13 @@ import ( | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/internal/summary" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func TestPrintsDependenciesIfPresent(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	task := &taskfile.Task{ | ||||
| 		Deps: []*taskfile.Dep{ | ||||
| 	task := &ast.Task{ | ||||
| 		Deps: []*ast.Dep{ | ||||
| 			{Task: "dep1"}, | ||||
| 			{Task: "dep2"}, | ||||
| 			{Task: "dep3"}, | ||||
| @@ -39,8 +39,8 @@ func createDummyLogger() (*bytes.Buffer, logger.Logger) { | ||||
|  | ||||
| func TestDoesNotPrintDependenciesIfMissing(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	task := &taskfile.Task{ | ||||
| 		Deps: []*taskfile.Dep{}, | ||||
| 	task := &ast.Task{ | ||||
| 		Deps: []*ast.Dep{}, | ||||
| 	} | ||||
|  | ||||
| 	summary.PrintTask(&l, task) | ||||
| @@ -50,7 +50,7 @@ func TestDoesNotPrintDependenciesIfMissing(t *testing.T) { | ||||
|  | ||||
| func TestPrintTaskName(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	task := &taskfile.Task{ | ||||
| 	task := &ast.Task{ | ||||
| 		Task: "my-task-name", | ||||
| 	} | ||||
|  | ||||
| @@ -61,8 +61,8 @@ func TestPrintTaskName(t *testing.T) { | ||||
|  | ||||
| func TestPrintTaskCommandsIfPresent(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	task := &taskfile.Task{ | ||||
| 		Cmds: []*taskfile.Cmd{ | ||||
| 	task := &ast.Task{ | ||||
| 		Cmds: []*ast.Cmd{ | ||||
| 			{Cmd: "command-1"}, | ||||
| 			{Cmd: "command-2"}, | ||||
| 			{Task: "task-1"}, | ||||
| @@ -79,8 +79,8 @@ func TestPrintTaskCommandsIfPresent(t *testing.T) { | ||||
|  | ||||
| func TestDoesNotPrintCommandIfMissing(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	task := &taskfile.Task{ | ||||
| 		Cmds: []*taskfile.Cmd{}, | ||||
| 	task := &ast.Task{ | ||||
| 		Cmds: []*ast.Cmd{}, | ||||
| 	} | ||||
|  | ||||
| 	summary.PrintTask(&l, task) | ||||
| @@ -90,13 +90,13 @@ func TestDoesNotPrintCommandIfMissing(t *testing.T) { | ||||
|  | ||||
| func TestLayout(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	task := &taskfile.Task{ | ||||
| 	task := &ast.Task{ | ||||
| 		Task:    "sample-task", | ||||
| 		Summary: "line1\nline2\nline3\n", | ||||
| 		Deps: []*taskfile.Dep{ | ||||
| 		Deps: []*ast.Dep{ | ||||
| 			{Task: "dependency"}, | ||||
| 		}, | ||||
| 		Cmds: []*taskfile.Cmd{ | ||||
| 		Cmds: []*ast.Cmd{ | ||||
| 			{Cmd: "command"}, | ||||
| 		}, | ||||
| 	} | ||||
| @@ -124,15 +124,15 @@ commands: | ||||
|  | ||||
| func TestPrintDescriptionAsFallback(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
| 	taskWithoutSummary := &taskfile.Task{ | ||||
| 	taskWithoutSummary := &ast.Task{ | ||||
| 		Desc: "description", | ||||
| 	} | ||||
|  | ||||
| 	taskWithSummary := &taskfile.Task{ | ||||
| 	taskWithSummary := &ast.Task{ | ||||
| 		Desc:    "description", | ||||
| 		Summary: "summary", | ||||
| 	} | ||||
| 	taskWithoutSummaryOrDescription := &taskfile.Task{} | ||||
| 	taskWithoutSummaryOrDescription := &ast.Task{} | ||||
|  | ||||
| 	summary.PrintTask(&l, taskWithoutSummary) | ||||
|  | ||||
| @@ -152,18 +152,18 @@ func TestPrintDescriptionAsFallback(t *testing.T) { | ||||
| func TestPrintAllWithSpaces(t *testing.T) { | ||||
| 	buffer, l := createDummyLogger() | ||||
|  | ||||
| 	t1 := &taskfile.Task{Task: "t1"} | ||||
| 	t2 := &taskfile.Task{Task: "t2"} | ||||
| 	t3 := &taskfile.Task{Task: "t3"} | ||||
| 	t1 := &ast.Task{Task: "t1"} | ||||
| 	t2 := &ast.Task{Task: "t2"} | ||||
| 	t3 := &ast.Task{Task: "t3"} | ||||
|  | ||||
| 	tasks := taskfile.Tasks{} | ||||
| 	tasks := ast.Tasks{} | ||||
| 	tasks.Set("t1", t1) | ||||
| 	tasks.Set("t2", t2) | ||||
| 	tasks.Set("t3", t3) | ||||
|  | ||||
| 	summary.PrintTasks(&l, | ||||
| 		&taskfile.Taskfile{Tasks: tasks}, | ||||
| 		[]taskfile.Call{{Task: "t1"}, {Task: "t2"}, {Task: "t3"}}) | ||||
| 		&ast.Taskfile{Tasks: tasks}, | ||||
| 		[]ast.Call{{Task: "t1"}, {Task: "t2"}, {Task: "t3"}}) | ||||
|  | ||||
| 	assert.True(t, strings.HasPrefix(buffer.String(), "task: t1")) | ||||
| 	assert.Contains(t, buffer.String(), "\n(task does not have description or summary)\n\n\ntask: t2") | ||||
|   | ||||
| @@ -7,7 +7,7 @@ import ( | ||||
|  | ||||
| 	"golang.org/x/exp/maps" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // Templater is a help struct that allow us to call "replaceX" funcs multiple | ||||
| @@ -15,7 +15,7 @@ import ( | ||||
| // happen will be assigned to r.err, and consecutive calls to funcs will just | ||||
| // return the zero value. | ||||
| type Templater struct { | ||||
| 	Vars *taskfile.Vars | ||||
| 	Vars *ast.Vars | ||||
|  | ||||
| 	cacheMap map[string]any | ||||
| 	err      error | ||||
| @@ -76,14 +76,14 @@ func (r *Templater) ReplaceSlice(strs []string) []string { | ||||
| 	return new | ||||
| } | ||||
|  | ||||
| func (r *Templater) ReplaceGlobs(globs []*taskfile.Glob) []*taskfile.Glob { | ||||
| func (r *Templater) ReplaceGlobs(globs []*ast.Glob) []*ast.Glob { | ||||
| 	if r.err != nil || len(globs) == 0 { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	new := make([]*taskfile.Glob, len(globs)) | ||||
| 	new := make([]*ast.Glob, len(globs)) | ||||
| 	for i, g := range globs { | ||||
| 		new[i] = &taskfile.Glob{ | ||||
| 		new[i] = &ast.Glob{ | ||||
| 			Glob:   r.Replace(g.Glob), | ||||
| 			Negate: g.Negate, | ||||
| 		} | ||||
| @@ -91,22 +91,22 @@ func (r *Templater) ReplaceGlobs(globs []*taskfile.Glob) []*taskfile.Glob { | ||||
| 	return new | ||||
| } | ||||
|  | ||||
| func (r *Templater) ReplaceVars(vars *taskfile.Vars) *taskfile.Vars { | ||||
| func (r *Templater) ReplaceVars(vars *ast.Vars) *ast.Vars { | ||||
| 	return r.replaceVars(vars, nil) | ||||
| } | ||||
|  | ||||
| func (r *Templater) ReplaceVarsWithExtra(vars *taskfile.Vars, extra map[string]any) *taskfile.Vars { | ||||
| func (r *Templater) ReplaceVarsWithExtra(vars *ast.Vars, extra map[string]any) *ast.Vars { | ||||
| 	return r.replaceVars(vars, extra) | ||||
| } | ||||
|  | ||||
| func (r *Templater) replaceVars(vars *taskfile.Vars, extra map[string]any) *taskfile.Vars { | ||||
| func (r *Templater) replaceVars(vars *ast.Vars, extra map[string]any) *ast.Vars { | ||||
| 	if r.err != nil || vars.Len() == 0 { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	var newVars taskfile.Vars | ||||
| 	_ = vars.Range(func(k string, v taskfile.Var) error { | ||||
| 		var newVar taskfile.Var | ||||
| 	var newVars ast.Vars | ||||
| 	_ = vars.Range(func(k string, v ast.Var) error { | ||||
| 		var newVar ast.Var | ||||
| 		switch value := v.Value.(type) { | ||||
| 		case string: | ||||
| 			newVar.Value = r.ReplaceWithExtra(value, extra) | ||||
|   | ||||
| @@ -7,13 +7,13 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/env" | ||||
| 	"github.com/go-task/task/v3/internal/execext" | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // ErrPreconditionFailed is returned when a precondition fails | ||||
| var ErrPreconditionFailed = errors.New("task: precondition not met") | ||||
|  | ||||
| func (e *Executor) areTaskPreconditionsMet(ctx context.Context, t *taskfile.Task) (bool, error) { | ||||
| func (e *Executor) areTaskPreconditionsMet(ctx context.Context, t *ast.Task) (bool, error) { | ||||
| 	for _, p := range t.Preconditions { | ||||
| 		err := execext.RunCommand(ctx, &execext.RunCommandOptions{ | ||||
| 			Command: p.Sh, | ||||
|   | ||||
| @@ -4,10 +4,10 @@ import ( | ||||
| 	"context" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/errors" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func (e *Executor) areTaskRequiredVarsSet(ctx context.Context, t *taskfile.Task, call taskfile.Call) error { | ||||
| func (e *Executor) areTaskRequiredVarsSet(ctx context.Context, t *ast.Task, call ast.Call) error { | ||||
| 	if t.Requires == nil || len(t.Requires.Vars) == 0 { | ||||
| 		return nil | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										18
									
								
								setup.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								setup.go
									
									
									
									
									
								
							| @@ -18,7 +18,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/internal/output" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/read" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func (e *Executor) Setup() error { | ||||
| @@ -69,7 +69,7 @@ func (e *Executor) setCurrentDir() error { | ||||
| 	} | ||||
|  | ||||
| 	// Search for a taskfile | ||||
| 	root, err := read.ExistsWalk(e.Dir) | ||||
| 	root, err := taskfile.ExistsWalk(e.Dir) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| @@ -81,11 +81,11 @@ func (e *Executor) setCurrentDir() error { | ||||
|  | ||||
| func (e *Executor) readTaskfile() error { | ||||
| 	uri := filepath.Join(e.Dir, e.Entrypoint) | ||||
| 	node, err := read.NewNode(uri, e.Insecure) | ||||
| 	node, err := taskfile.NewNode(uri, e.Insecure) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	e.Taskfile, err = read.Taskfile( | ||||
| 	e.Taskfile, err = taskfile.Read( | ||||
| 		node, | ||||
| 		e.Insecure, | ||||
| 		e.Download, | ||||
| @@ -197,16 +197,16 @@ func (e *Executor) setupCompiler() error { | ||||
| } | ||||
|  | ||||
| func (e *Executor) readDotEnvFiles() error { | ||||
| 	if e.Taskfile.Version.LessThan(taskfile.V3) { | ||||
| 	if e.Taskfile.Version.LessThan(ast.V3) { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	env, err := read.Dotenv(e.Compiler, e.Taskfile, e.Dir) | ||||
| 	env, err := taskfile.Dotenv(e.Compiler, e.Taskfile, e.Dir) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	err = env.Range(func(key string, value taskfile.Var) error { | ||||
| 	err = env.Range(func(key string, value ast.Var) error { | ||||
| 		if ok := e.Taskfile.Env.Exists(key); !ok { | ||||
| 			e.Taskfile.Env.Set(key, value) | ||||
| 		} | ||||
| @@ -244,12 +244,12 @@ func (e *Executor) doVersionChecks() error { | ||||
| 	v := &semver.Version{} | ||||
| 	*v = *e.Taskfile.Version | ||||
|  | ||||
| 	if v.LessThan(taskfile.V3) { | ||||
| 	if v.LessThan(ast.V3) { | ||||
| 		return fmt.Errorf(`task: Taskfile schemas prior to v3 are no longer supported`) | ||||
| 	} | ||||
|  | ||||
| 	// consider as equal to the greater version if round | ||||
| 	if v.Equal(taskfile.V3) { | ||||
| 	if v.Equal(ast.V3) { | ||||
| 		v = semver.MustParse("3.8") | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -5,11 +5,11 @@ import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/internal/fingerprint" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // Status returns an error if any the of given tasks is not up-to-date | ||||
| func (e *Executor) Status(ctx context.Context, calls ...taskfile.Call) error { | ||||
| func (e *Executor) Status(ctx context.Context, calls ...ast.Call) error { | ||||
| 	for _, call := range calls { | ||||
|  | ||||
| 		// Compile the task | ||||
| @@ -41,7 +41,7 @@ func (e *Executor) Status(ctx context.Context, calls ...taskfile.Call) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (e *Executor) statusOnError(t *taskfile.Task) error { | ||||
| func (e *Executor) statusOnError(t *ast.Task) error { | ||||
| 	method := t.Method | ||||
| 	if method == "" { | ||||
| 		method = e.Taskfile.Method | ||||
|   | ||||
							
								
								
									
										42
									
								
								task.go
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								task.go
									
									
									
									
									
								
							| @@ -21,7 +21,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/sort" | ||||
| 	"github.com/go-task/task/v3/internal/summary" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
|  | ||||
| 	"github.com/sajari/fuzzy" | ||||
| 	"golang.org/x/exp/slices" | ||||
| @@ -36,7 +36,7 @@ const ( | ||||
|  | ||||
| // Executor executes a Taskfile | ||||
| type Executor struct { | ||||
| 	Taskfile *taskfile.Taskfile | ||||
| 	Taskfile *ast.Taskfile | ||||
|  | ||||
| 	Dir         string | ||||
| 	TempDir     string | ||||
| @@ -66,7 +66,7 @@ type Executor struct { | ||||
| 	Logger         *logger.Logger | ||||
| 	Compiler       *compiler.Compiler | ||||
| 	Output         output.Output | ||||
| 	OutputStyle    taskfile.Output | ||||
| 	OutputStyle    ast.Output | ||||
| 	TaskSorter     sort.TaskSorter | ||||
| 	UserWorkingDir string | ||||
|  | ||||
| @@ -80,7 +80,7 @@ type Executor struct { | ||||
| } | ||||
|  | ||||
| // Run runs Task | ||||
| func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error { | ||||
| func (e *Executor) Run(ctx context.Context, calls ...ast.Call) error { | ||||
| 	// check if given tasks exist | ||||
| 	for _, call := range calls { | ||||
| 		task, err := e.GetTask(call) | ||||
| @@ -142,7 +142,7 @@ func (e *Executor) Run(ctx context.Context, calls ...taskfile.Call) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (e *Executor) splitRegularAndWatchCalls(calls ...taskfile.Call) (regularCalls []taskfile.Call, watchCalls []taskfile.Call, err error) { | ||||
| func (e *Executor) splitRegularAndWatchCalls(calls ...ast.Call) (regularCalls []ast.Call, watchCalls []ast.Call, err error) { | ||||
| 	for _, c := range calls { | ||||
| 		t, err := e.GetTask(c) | ||||
| 		if err != nil { | ||||
| @@ -159,7 +159,7 @@ func (e *Executor) splitRegularAndWatchCalls(calls ...taskfile.Call) (regularCal | ||||
| } | ||||
|  | ||||
| // RunTask runs a task by its name | ||||
| func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error { | ||||
| func (e *Executor) RunTask(ctx context.Context, call ast.Call) error { | ||||
| 	t, err := e.FastCompiledTask(call) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| @@ -270,7 +270,7 @@ func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error { | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| func (e *Executor) mkdir(t *taskfile.Task) error { | ||||
| func (e *Executor) mkdir(t *ast.Task) error { | ||||
| 	if t.Dir == "" { | ||||
| 		return nil | ||||
| 	} | ||||
| @@ -287,7 +287,7 @@ func (e *Executor) mkdir(t *taskfile.Task) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (e *Executor) runDeps(ctx context.Context, t *taskfile.Task) error { | ||||
| func (e *Executor) runDeps(ctx context.Context, t *ast.Task) error { | ||||
| 	g, ctx := errgroup.WithContext(ctx) | ||||
|  | ||||
| 	reacquire := e.releaseConcurrencyLimit() | ||||
| @@ -296,7 +296,7 @@ func (e *Executor) runDeps(ctx context.Context, t *taskfile.Task) error { | ||||
| 	for _, d := range t.Deps { | ||||
| 		d := d | ||||
| 		g.Go(func() error { | ||||
| 			err := e.RunTask(ctx, taskfile.Call{Task: d.Task, Vars: d.Vars, Silent: d.Silent}) | ||||
| 			err := e.RunTask(ctx, ast.Call{Task: d.Task, Vars: d.Vars, Silent: d.Silent}) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| @@ -307,7 +307,7 @@ func (e *Executor) runDeps(ctx context.Context, t *taskfile.Task) error { | ||||
| 	return g.Wait() | ||||
| } | ||||
|  | ||||
| func (e *Executor) runDeferred(t *taskfile.Task, call taskfile.Call, i int) { | ||||
| func (e *Executor) runDeferred(t *ast.Task, call ast.Call, i int) { | ||||
| 	ctx, cancel := context.WithCancel(context.Background()) | ||||
| 	defer cancel() | ||||
|  | ||||
| @@ -316,7 +316,7 @@ func (e *Executor) runDeferred(t *taskfile.Task, call taskfile.Call, i int) { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfile.Call, i int) error { | ||||
| func (e *Executor) runCommand(ctx context.Context, t *ast.Task, call ast.Call, i int) error { | ||||
| 	cmd := t.Cmds[i] | ||||
|  | ||||
| 	switch { | ||||
| @@ -324,7 +324,7 @@ func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfi | ||||
| 		reacquire := e.releaseConcurrencyLimit() | ||||
| 		defer reacquire() | ||||
|  | ||||
| 		err := e.RunTask(ctx, taskfile.Call{Task: cmd.Task, Vars: cmd.Vars, Silent: cmd.Silent}) | ||||
| 		err := e.RunTask(ctx, ast.Call{Task: cmd.Task, Vars: cmd.Vars, Silent: cmd.Silent}) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| @@ -377,7 +377,7 @@ func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfi | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (e *Executor) startExecution(ctx context.Context, t *taskfile.Task, execute func(ctx context.Context) error) error { | ||||
| func (e *Executor) startExecution(ctx context.Context, t *ast.Task, execute func(ctx context.Context) error) error { | ||||
| 	h, err := e.GetHash(t) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| @@ -413,7 +413,7 @@ func (e *Executor) startExecution(ctx context.Context, t *taskfile.Task, execute | ||||
| // GetTask will return the task with the name matching the given call from the taskfile. | ||||
| // If no task is found, it will search for tasks with a matching alias. | ||||
| // If multiple tasks contain the same alias or no matches are found an error is returned. | ||||
| func (e *Executor) GetTask(call taskfile.Call) (*taskfile.Task, error) { | ||||
| func (e *Executor) GetTask(call ast.Call) (*ast.Task, error) { | ||||
| 	// Search for a matching task | ||||
| 	matchingTask := e.Taskfile.Tasks.Get(call.Task) | ||||
| 	if matchingTask != nil { | ||||
| @@ -450,10 +450,10 @@ func (e *Executor) GetTask(call taskfile.Call) (*taskfile.Task, error) { | ||||
| 	return matchingTask, nil | ||||
| } | ||||
|  | ||||
| type FilterFunc func(task *taskfile.Task) bool | ||||
| type FilterFunc func(task *ast.Task) bool | ||||
|  | ||||
| func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*taskfile.Task, error) { | ||||
| 	tasks := make([]*taskfile.Task, 0, e.Taskfile.Tasks.Len()) | ||||
| func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*ast.Task, error) { | ||||
| 	tasks := make([]*ast.Task, 0, e.Taskfile.Tasks.Len()) | ||||
|  | ||||
| 	// Create an error group to wait for each task to be compiled | ||||
| 	var g errgroup.Group | ||||
| @@ -476,7 +476,7 @@ func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*taskfile.Task, error) | ||||
| 		idx := i | ||||
| 		task := tasks[idx] | ||||
| 		g.Go(func() error { | ||||
| 			compiledTask, err := e.FastCompiledTask(taskfile.Call{Task: task.Task}) | ||||
| 			compiledTask, err := e.FastCompiledTask(ast.Call{Task: task.Task}) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| @@ -500,16 +500,16 @@ func (e *Executor) GetTaskList(filters ...FilterFunc) ([]*taskfile.Task, error) | ||||
| } | ||||
|  | ||||
| // FilterOutNoDesc removes all tasks that do not contain a description. | ||||
| func FilterOutNoDesc(task *taskfile.Task) bool { | ||||
| func FilterOutNoDesc(task *ast.Task) bool { | ||||
| 	return task.Desc == "" | ||||
| } | ||||
|  | ||||
| // FilterOutInternal removes all tasks that are marked as internal. | ||||
| func FilterOutInternal(task *taskfile.Task) bool { | ||||
| func FilterOutInternal(task *ast.Task) bool { | ||||
| 	return task.Internal | ||||
| } | ||||
|  | ||||
| func shouldRunOnCurrentPlatform(platforms []*taskfile.Platform) bool { | ||||
| func shouldRunOnCurrentPlatform(platforms []*ast.Platform) bool { | ||||
| 	if len(platforms) == 0 { | ||||
| 		return true | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										192
									
								
								task_test.go
									
									
									
									
									
								
							
							
						
						
									
										192
									
								
								task_test.go
									
									
									
									
									
								
							| @@ -18,7 +18,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3" | ||||
| 	"github.com/go-task/task/v3/errors" | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func init() { | ||||
| @@ -52,7 +52,7 @@ func (fct fileContentTest) Run(t *testing.T) { | ||||
| 		Stderr:     io.Discard, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup(), "e.Setup()") | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: fct.Target}), "e.Run(target)") | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: fct.Target}), "e.Run(target)") | ||||
|  | ||||
| 	for name, expectContent := range fct.Files { | ||||
| 		t.Run(fct.name(name), func(t *testing.T) { | ||||
| @@ -75,7 +75,7 @@ func TestEmptyTask(t *testing.T) { | ||||
| 		Stderr: io.Discard, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup(), "e.Setup()") | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| } | ||||
|  | ||||
| func TestEnv(t *testing.T) { | ||||
| @@ -118,7 +118,7 @@ func TestSpecialVars(t *testing.T) { | ||||
| 		Silent: true, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: target})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: target})) | ||||
|  | ||||
| 	toAbs := func(rel string) string { | ||||
| 		abs, err := filepath.Abs(rel) | ||||
| @@ -154,7 +154,7 @@ func TestConcurrency(t *testing.T) { | ||||
| 		Concurrency: 1, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup(), "e.Setup()") | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: target}), "e.Run(target)") | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: target}), "e.Run(target)") | ||||
| } | ||||
|  | ||||
| func TestParams(t *testing.T) { | ||||
| @@ -206,7 +206,7 @@ func TestDeps(t *testing.T) { | ||||
| 		Stderr: io.Discard, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
|  | ||||
| 	for _, f := range files { | ||||
| 		f = filepathext.SmartJoin(dir, f) | ||||
| @@ -243,15 +243,15 @@ func TestStatus(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	// gen-foo creates foo.txt, and will always fail it's status check. | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-foo"})) | ||||
| 	// gen-foo creates bar.txt, and will pass its status-check the 3. time it | ||||
| 	// is run. It creates bar.txt, but also lists it as its source. So, the checksum | ||||
| 	// for the file won't match before after the second run as we the file | ||||
| 	// only exists after the first run. | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-bar"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-bar"})) | ||||
| 	// gen-silent-baz is marked as being silent, and should only produce output | ||||
| 	// if e.Verbose is set to true. | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-silent-baz"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-silent-baz"})) | ||||
|  | ||||
| 	for _, f := range files { | ||||
| 		if _, err := os.Stat(filepathext.SmartJoin(dir, f)); err != nil { | ||||
| @@ -260,10 +260,10 @@ func TestStatus(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	// Run gen-bar a second time to produce a checksum file that matches bar.txt | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-bar"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-bar"})) | ||||
|  | ||||
| 	// Run gen-bar a third time, to make sure we've triggered the status check. | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-bar"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-bar"})) | ||||
|  | ||||
| 	// We're silent, so no output should have been produced. | ||||
| 	assert.Empty(t, buff.String()) | ||||
| @@ -272,7 +272,7 @@ func TestStatus(t *testing.T) { | ||||
| 	// for the next test. | ||||
| 	err := os.Remove(filepathext.SmartJoin(dir, "bar.txt")) | ||||
| 	require.NoError(t, err) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-bar"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-bar"})) | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// Global silence switched of, so we should see output unless the task itself | ||||
| @@ -280,34 +280,34 @@ func TestStatus(t *testing.T) { | ||||
| 	e.Silent = false | ||||
|  | ||||
| 	// all: not up-to-date | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-foo"})) | ||||
| 	assert.Equal(t, "task: [gen-foo] touch foo.txt", strings.TrimSpace(buff.String())) | ||||
| 	buff.Reset() | ||||
| 	// status: not up-to-date | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-foo"})) | ||||
| 	assert.Equal(t, "task: [gen-foo] touch foo.txt", strings.TrimSpace(buff.String())) | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// sources: not up-to-date | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-bar"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-bar"})) | ||||
| 	assert.Equal(t, "task: [gen-bar] touch bar.txt", strings.TrimSpace(buff.String())) | ||||
| 	buff.Reset() | ||||
| 	// all: up-to-date | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-bar"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-bar"})) | ||||
| 	assert.Equal(t, `task: Task "gen-bar" is up to date`, strings.TrimSpace(buff.String())) | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// sources: not up-to-date, no output produced. | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-silent-baz"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-silent-baz"})) | ||||
| 	assert.Empty(t, buff.String()) | ||||
|  | ||||
| 	// up-to-date, no output produced | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-silent-baz"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-silent-baz"})) | ||||
| 	assert.Empty(t, buff.String()) | ||||
|  | ||||
| 	e.Verbose = true | ||||
| 	// up-to-date, output produced due to Verbose mode. | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "gen-silent-baz"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "gen-silent-baz"})) | ||||
| 	assert.Equal(t, `task: Task "gen-silent-baz" is up to date`, strings.TrimSpace(buff.String())) | ||||
| 	buff.Reset() | ||||
| } | ||||
| @@ -324,13 +324,13 @@ func TestPrecondition(t *testing.T) { | ||||
|  | ||||
| 	// A precondition that has been met | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "foo"})) | ||||
| 	if buff.String() != "" { | ||||
| 		t.Errorf("Got Output when none was expected: %s", buff.String()) | ||||
| 	} | ||||
|  | ||||
| 	// A precondition that was not met | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "impossible"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "impossible"})) | ||||
|  | ||||
| 	if buff.String() != "task: 1 != 0 obviously!\n" { | ||||
| 		t.Errorf("Wrong output message: %s", buff.String()) | ||||
| @@ -338,7 +338,7 @@ func TestPrecondition(t *testing.T) { | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// Calling a task with a precondition in a dependency fails the task | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "depends_on_impossible"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "depends_on_impossible"})) | ||||
|  | ||||
| 	if buff.String() != "task: 1 != 0 obviously!\n" { | ||||
| 		t.Errorf("Wrong output message: %s", buff.String()) | ||||
| @@ -346,7 +346,7 @@ func TestPrecondition(t *testing.T) { | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// Calling a task with a precondition in a cmd fails the task | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "executes_failing_task_as_cmd"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "executes_failing_task_as_cmd"})) | ||||
| 	if buff.String() != "task: 1 != 0 obviously!\n" { | ||||
| 		t.Errorf("Wrong output message: %s", buff.String()) | ||||
| 	} | ||||
| @@ -387,7 +387,7 @@ func TestGenerates(t *testing.T) { | ||||
| 			fmt.Sprintf("task: Task \"%s\" is up to date\n", theTask) | ||||
|  | ||||
| 		// Run task for the first time. | ||||
| 		require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: theTask})) | ||||
| 		require.NoError(t, e.Run(context.Background(), ast.Call{Task: theTask})) | ||||
|  | ||||
| 		if _, err := os.Stat(srcFile); err != nil { | ||||
| 			t.Errorf("File should exist: %v", err) | ||||
| @@ -402,7 +402,7 @@ func TestGenerates(t *testing.T) { | ||||
| 		buff.Reset() | ||||
|  | ||||
| 		// Re-run task to ensure it's now found to be up-to-date. | ||||
| 		require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: theTask})) | ||||
| 		require.NoError(t, e.Run(context.Background(), ast.Call{Task: theTask})) | ||||
| 		if buff.String() != upToDate { | ||||
| 			t.Errorf("Wrong output message: %s", buff.String()) | ||||
| 		} | ||||
| @@ -440,7 +440,7 @@ func TestStatusChecksum(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: test.task})) | ||||
| 			require.NoError(t, e.Run(context.Background(), ast.Call{Task: test.task})) | ||||
| 			for _, f := range test.files { | ||||
| 				_, err := os.Stat(filepathext.SmartJoin(dir, f)) | ||||
| 				require.NoError(t, err) | ||||
| @@ -453,7 +453,7 @@ func TestStatusChecksum(t *testing.T) { | ||||
| 			time := s.ModTime() | ||||
|  | ||||
| 			buff.Reset() | ||||
| 			require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: test.task})) | ||||
| 			require.NoError(t, e.Run(context.Background(), ast.Call{Task: test.task})) | ||||
| 			assert.Equal(t, `task: Task "`+test.task+`" is up to date`+"\n", buff.String()) | ||||
|  | ||||
| 			s, err = os.Stat(filepathext.SmartJoin(tempdir, "checksum/"+test.task)) | ||||
| @@ -476,7 +476,7 @@ func TestAlias(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "f"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "f"})) | ||||
| 	assert.Equal(t, string(data), buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -490,7 +490,7 @@ func TestDuplicateAlias(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "x"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "x"})) | ||||
| 	assert.Equal(t, "", buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -508,7 +508,7 @@ func TestAliasSummary(t *testing.T) { | ||||
| 		Stderr:  &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "f"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "f"})) | ||||
| 	assert.Equal(t, string(data), buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -522,7 +522,7 @@ func TestLabelUpToDate(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "foo"})) | ||||
| 	assert.Contains(t, buff.String(), "foobar") | ||||
| } | ||||
|  | ||||
| @@ -537,7 +537,7 @@ func TestLabelSummary(t *testing.T) { | ||||
| 		Stderr:  &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "foo"})) | ||||
| 	assert.Contains(t, buff.String(), "foobar") | ||||
| } | ||||
|  | ||||
| @@ -548,7 +548,7 @@ func TestLabelInStatus(t *testing.T) { | ||||
| 		Dir: dir, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	err := e.Status(context.Background(), taskfile.Call{Task: "foo"}) | ||||
| 	err := e.Status(context.Background(), ast.Call{Task: "foo"}) | ||||
| 	assert.ErrorContains(t, err, "foobar") | ||||
| } | ||||
|  | ||||
| @@ -562,7 +562,7 @@ func TestLabelWithVariableExpansion(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "foo"})) | ||||
| 	assert.Contains(t, buff.String(), "foobaz") | ||||
| } | ||||
|  | ||||
| @@ -576,7 +576,7 @@ func TestLabelInSummary(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "foo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "foo"})) | ||||
| 	assert.Contains(t, buff.String(), "foobar") | ||||
| } | ||||
|  | ||||
| @@ -612,7 +612,7 @@ func TestPromptInSummary(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: "foo"}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: "foo"}) | ||||
|  | ||||
| 			if test.wantError { | ||||
| 				require.Error(t, err) | ||||
| @@ -640,7 +640,7 @@ func TestPromptWithIndirectTask(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "bar"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "bar"}) | ||||
| 	assert.Contains(t, outBuff.String(), "show-prompt") | ||||
| 	require.NoError(t, err) | ||||
| } | ||||
| @@ -673,7 +673,7 @@ func TestPromptAssumeYes(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: "foo"}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: "foo"}) | ||||
|  | ||||
| 			if !test.assumeYes { | ||||
| 				require.Error(t, err) | ||||
| @@ -785,7 +785,7 @@ func TestStatusVariables(t *testing.T) { | ||||
| 		Verbose: true, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "build"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "build"})) | ||||
|  | ||||
| 	assert.Contains(t, buff.String(), "3e464c4b03f4b65d740e1e130d4d108a") | ||||
|  | ||||
| @@ -826,7 +826,7 @@ func TestCyclicDep(t *testing.T) { | ||||
| 		Stderr: io.Discard, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	assert.IsType(t, &errors.TaskCalledTooManyTimesError{}, e.Run(context.Background(), taskfile.Call{Task: "task-1"})) | ||||
| 	assert.IsType(t, &errors.TaskCalledTooManyTimesError{}, e.Run(context.Background(), ast.Call{Task: "task-1"})) | ||||
| } | ||||
|  | ||||
| func TestTaskVersion(t *testing.T) { | ||||
| @@ -869,10 +869,10 @@ func TestTaskIgnoreErrors(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-should-pass"})) | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "task-should-fail"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "cmd-should-pass"})) | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "cmd-should-fail"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "task-should-pass"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "task-should-fail"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "cmd-should-pass"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "cmd-should-fail"})) | ||||
| } | ||||
|  | ||||
| func TestExpand(t *testing.T) { | ||||
| @@ -890,7 +890,7 @@ func TestExpand(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "pwd"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "pwd"})) | ||||
| 	assert.Equal(t, home, strings.TrimSpace(buff.String())) | ||||
| } | ||||
|  | ||||
| @@ -909,7 +909,7 @@ func TestDry(t *testing.T) { | ||||
| 		Dry:    true, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "build"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "build"})) | ||||
|  | ||||
| 	assert.Equal(t, "task: [build] touch file.txt", strings.TrimSpace(buff.String())) | ||||
| 	if _, err := os.Stat(file); err == nil { | ||||
| @@ -933,13 +933,13 @@ func TestDryChecksum(t *testing.T) { | ||||
| 		Dry:     true, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
|  | ||||
| 	_, err := os.Stat(checksumFile) | ||||
| 	require.Error(t, err, "checksum file should not exist") | ||||
|  | ||||
| 	e.Dry = false | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 	_, err = os.Stat(checksumFile) | ||||
| 	require.NoError(t, err, "checksum file should exist") | ||||
| } | ||||
| @@ -1121,11 +1121,11 @@ func TestIncludesRelativePath(t *testing.T) { | ||||
|  | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "common:pwd"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "common:pwd"})) | ||||
| 	assert.Contains(t, buff.String(), "testdata/includes_rel_path/common") | ||||
|  | ||||
| 	buff.Reset() | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "included:common:pwd"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "included:common:pwd"})) | ||||
| 	assert.Contains(t, buff.String(), "testdata/includes_rel_path/common") | ||||
| } | ||||
|  | ||||
| @@ -1153,7 +1153,7 @@ func TestIncludesInternal(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: test.task}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: test.task}) | ||||
| 			if test.expectedErr { | ||||
| 				require.Error(t, err) | ||||
| 			} else { | ||||
| @@ -1187,7 +1187,7 @@ func TestIncludesInterpolation(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: test.task}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: test.task}) | ||||
| 			if test.expectedErr { | ||||
| 				require.Error(t, err) | ||||
| 			} else { | ||||
| @@ -1222,7 +1222,7 @@ func TestInternalTask(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: test.task}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: test.task}) | ||||
| 			if test.expectedErr { | ||||
| 				require.Error(t, err) | ||||
| 			} else { | ||||
| @@ -1291,7 +1291,7 @@ func TestSummary(t *testing.T) { | ||||
| 		Silent:  true, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-summary"}, taskfile.Call{Task: "other-task-with-summary"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "task-with-summary"}, ast.Call{Task: "other-task-with-summary"})) | ||||
|  | ||||
| 	data, err := os.ReadFile(filepathext.SmartJoin(dir, "task-with-summary.txt")) | ||||
| 	require.NoError(t, err) | ||||
| @@ -1315,7 +1315,7 @@ func TestWhenNoDirAttributeItRunsInSameDirAsTaskfile(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "whereami"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "whereami"})) | ||||
|  | ||||
| 	// got should be the "dir" part of "testdata/dir" | ||||
| 	got := strings.TrimSuffix(filepath.Base(out.String()), "\n") | ||||
| @@ -1333,7 +1333,7 @@ func TestWhenDirAttributeAndDirExistsItRunsInThatDir(t *testing.T) { | ||||
| 	} | ||||
|  | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "whereami"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "whereami"})) | ||||
|  | ||||
| 	got := strings.TrimSuffix(filepath.Base(out.String()), "\n") | ||||
| 	assert.Equal(t, expected, got, "Mismatch in the working directory") | ||||
| @@ -1357,7 +1357,7 @@ func TestWhenDirAttributeItCreatesMissingAndRunsInThatDir(t *testing.T) { | ||||
| 		t.Errorf("Directory should not exist: %v", err) | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: target})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: target})) | ||||
|  | ||||
| 	got := strings.TrimSuffix(filepath.Base(out.String()), "\n") | ||||
| 	assert.Equal(t, expected, got, "Mismatch in the working directory") | ||||
| @@ -1384,7 +1384,7 @@ func TestDynamicVariablesRunOnTheNewCreatedDir(t *testing.T) { | ||||
| 		t.Errorf("Directory should not exist: %v", err) | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: target})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: target})) | ||||
|  | ||||
| 	got := strings.TrimSuffix(filepath.Base(out.String()), "\n") | ||||
| 	assert.Equal(t, expected, got, "Mismatch in the working directory") | ||||
| @@ -1442,7 +1442,7 @@ func TestShortTaskNotation(t *testing.T) { | ||||
| 		Silent: true, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 	assert.Equal(t, "string-slice-1\nstring-slice-2\nstring\n", buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -1586,7 +1586,7 @@ func TestExitImmediately(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 	assert.Contains(t, buff.String(), `"this_should_fail": executable file not found in $PATH`) | ||||
| } | ||||
|  | ||||
| @@ -1622,7 +1622,7 @@ echo ran | ||||
| task: [task-1] echo 'task-1 ran successfully' | ||||
| task-1 ran successfully | ||||
| `) | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "task-2"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "task-2"})) | ||||
| 	assert.Contains(t, buff.String(), expectedOutputOrder) | ||||
| } | ||||
|  | ||||
| @@ -1647,7 +1647,7 @@ func TestIgnoreNilElements(t *testing.T) { | ||||
| 				Silent: true, | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
| 			require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 			require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 			assert.Equal(t, "string-slice-1\n", buff.String()) | ||||
| 		}) | ||||
| 	} | ||||
| @@ -1673,7 +1673,7 @@ task: [bye] echo 'Bye!' | ||||
| Bye! | ||||
| ::endgroup:: | ||||
| `) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "bye"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "bye"})) | ||||
| 	t.Log(buff.String()) | ||||
| 	assert.Equal(t, strings.TrimSpace(buff.String()), expectedOutputOrder) | ||||
| } | ||||
| @@ -1688,7 +1688,7 @@ func TestOutputGroupErrorOnlySwallowsOutputOnSuccess(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "passing"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "passing"})) | ||||
| 	t.Log(buff.String()) | ||||
| 	assert.Empty(t, buff.String()) | ||||
| } | ||||
| @@ -1703,7 +1703,7 @@ func TestOutputGroupErrorOnlyShowsOutputOnFailure(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	require.Error(t, e.Run(context.Background(), taskfile.Call{Task: "failing"})) | ||||
| 	require.Error(t, e.Run(context.Background(), ast.Call{Task: "failing"})) | ||||
| 	t.Log(buff.String()) | ||||
| 	assert.Contains(t, "failing-output", strings.TrimSpace(buff.String())) | ||||
| 	assert.NotContains(t, "passing", strings.TrimSpace(buff.String())) | ||||
| @@ -1733,7 +1733,7 @@ VAR_1 is included-default-var1 | ||||
| task: [included3:task1] echo "VAR_2 is included-default-var2" | ||||
| VAR_2 is included-default-var2 | ||||
| `) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task1"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "task1"})) | ||||
| 	t.Log(buff.String()) | ||||
| 	assert.Equal(t, strings.TrimSpace(buff.String()), expectedOutputOrder) | ||||
| } | ||||
| @@ -1756,7 +1756,7 @@ Hello foo | ||||
| task: [bar:lib:greet] echo 'Hello bar' | ||||
| Hello bar | ||||
| `) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 	t.Log(buff.String()) | ||||
| 	assert.Equal(t, strings.TrimSpace(buff.String()), expectedOutputOrder) | ||||
| } | ||||
| @@ -1789,7 +1789,7 @@ func TestErrorCode(t *testing.T) { | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
|  | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: test.task, Direct: true}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: test.task, Direct: true}) | ||||
| 			require.Error(t, err) | ||||
| 			taskRunErr, ok := err.(*errors.TaskRunError) | ||||
| 			assert.True(t, ok, "cannot cast returned error to *task.TaskRunError") | ||||
| @@ -1841,7 +1841,7 @@ func TestEvaluateSymlinksInPaths(t *testing.T) { | ||||
| 	for _, test := range tests { | ||||
| 		t.Run(test.name, func(t *testing.T) { | ||||
| 			require.NoError(t, e.Setup()) | ||||
| 			err := e.Run(context.Background(), taskfile.Call{Task: test.task}) | ||||
| 			err := e.Run(context.Background(), ast.Call{Task: test.task}) | ||||
| 			require.NoError(t, err) | ||||
| 			assert.Equal(t, test.expected, strings.TrimSpace(buff.String())) | ||||
| 			buff.Reset() | ||||
| @@ -1880,7 +1880,7 @@ func TestTaskfileWalk(t *testing.T) { | ||||
| 				Stderr: &buff, | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
| 			require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 			require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 			assert.Equal(t, test.expected, buff.String()) | ||||
| 		}) | ||||
| 	} | ||||
| @@ -1896,7 +1896,7 @@ func TestUserWorkingDirectory(t *testing.T) { | ||||
| 	wd, err := os.Getwd() | ||||
| 	require.NoError(t, err) | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "default"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "default"})) | ||||
| 	assert.Equal(t, fmt.Sprintf("%s\n", wd), buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -1916,7 +1916,7 @@ func TestUserWorkingDirectoryWithIncluded(t *testing.T) { | ||||
|  | ||||
| 	require.NoError(t, err) | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "included:echo"})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "included:echo"})) | ||||
| 	assert.Equal(t, fmt.Sprintf("%s\n", wd), buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -1928,7 +1928,7 @@ func TestPlatforms(t *testing.T) { | ||||
| 		Stderr: &buff, | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
| 	require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "build-" + runtime.GOOS})) | ||||
| 	require.NoError(t, e.Run(context.Background(), ast.Call{Task: "build-" + runtime.GOOS})) | ||||
| 	assert.Equal(t, fmt.Sprintf("task: [build-%s] echo 'Running task on %s'\nRunning task on %s\n", runtime.GOOS, runtime.GOOS, runtime.GOOS), buff.String()) | ||||
| } | ||||
|  | ||||
| @@ -1941,7 +1941,7 @@ func TestPOSIXShellOptsGlobalLevel(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "pipefail"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "pipefail"}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "pipefail\ton\n", buff.String()) | ||||
| } | ||||
| @@ -1955,7 +1955,7 @@ func TestPOSIXShellOptsTaskLevel(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "pipefail"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "pipefail"}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "pipefail\ton\n", buff.String()) | ||||
| } | ||||
| @@ -1969,7 +1969,7 @@ func TestPOSIXShellOptsCommandLevel(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "pipefail"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "pipefail"}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "pipefail\ton\n", buff.String()) | ||||
| } | ||||
| @@ -1983,7 +1983,7 @@ func TestBashShellOptsGlobalLevel(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "globstar"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "globstar"}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "globstar\ton\n", buff.String()) | ||||
| } | ||||
| @@ -1997,7 +1997,7 @@ func TestBashShellOptsTaskLevel(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "globstar"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "globstar"}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "globstar\ton\n", buff.String()) | ||||
| } | ||||
| @@ -2011,7 +2011,7 @@ func TestBashShellOptsCommandLevel(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "globstar"}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "globstar"}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "globstar\ton\n", buff.String()) | ||||
| } | ||||
| @@ -2026,10 +2026,10 @@ func TestSplitArgs(t *testing.T) { | ||||
| 	} | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	vars := &taskfile.Vars{} | ||||
| 	vars.Set("CLI_ARGS", taskfile.Var{Value: "foo bar 'foo bar baz'"}) | ||||
| 	vars := &ast.Vars{} | ||||
| 	vars.Set("CLI_ARGS", ast.Var{Value: "foo bar 'foo bar baz'"}) | ||||
|  | ||||
| 	err := e.Run(context.Background(), taskfile.Call{Task: "default", Vars: vars}) | ||||
| 	err := e.Run(context.Background(), ast.Call{Task: "default", Vars: vars}) | ||||
| 	require.NoError(t, err) | ||||
| 	assert.Equal(t, "3\n", buff.String()) | ||||
| } | ||||
| @@ -2057,20 +2057,20 @@ func TestSilence(t *testing.T) { | ||||
| 	require.NoError(t, e.Setup()) | ||||
|  | ||||
| 	// First verify that the silent flag is in place. | ||||
| 	task, err := e.GetTask(taskfile.Call{Task: "task-test-silent-calls-chatty-silenced"}) | ||||
| 	task, err := e.GetTask(ast.Call{Task: "task-test-silent-calls-chatty-silenced"}) | ||||
| 	require.NoError(t, err, "Unable to look up task task-test-silent-calls-chatty-silenced") | ||||
| 	require.True(t, task.Cmds[0].Silent, "The task task-test-silent-calls-chatty-silenced should have a silent call to chatty") | ||||
|  | ||||
| 	// Then test the two basic cases where the task is silent or not. | ||||
| 	// A silenced task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "silent"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "silent"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Empty(t, buff.String(), "siWhile running lent: Expected not see output, because the task is silent") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A chatty (not silent) task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "chatty"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "chatty"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.NotEmpty(t, buff.String(), "chWhile running atty: Expected to see output, because the task is not silent") | ||||
|  | ||||
| @@ -2078,42 +2078,42 @@ func TestSilence(t *testing.T) { | ||||
|  | ||||
| 	// Then test invoking the two task from other tasks. | ||||
| 	// A silenced task that calls a chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-silent-calls-chatty-non-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-silent-calls-chatty-non-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.NotEmpty(t, buff.String(), "While running task-test-silent-calls-chatty-non-silenced: Expected to see output. The task is silenced, but the called task is not. Silence does not propagate to called tasks.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A silent task that does a silent call to a chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-silent-calls-chatty-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-silent-calls-chatty-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Empty(t, buff.String(), "While running task-test-silent-calls-chatty-silenced: Expected not to see output. The task calls chatty task, but the call is silenced.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A chatty task that does a call to a chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-chatty-calls-chatty-non-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-chatty-calls-chatty-non-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.NotEmpty(t, buff.String(), "While running task-test-chatty-calls-chatty-non-silenced: Expected to see output. Both caller and callee are chatty and not silenced.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A chatty task that does a silenced call to a chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-chatty-calls-chatty-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-chatty-calls-chatty-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.NotEmpty(t, buff.String(), "While running task-test-chatty-calls-chatty-silenced: Expected to see output. Call to a chatty task is silenced, but the parent task is not.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A chatty task with no cmd's of its own that does a silenced call to a chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-no-cmds-calls-chatty-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-no-cmds-calls-chatty-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Empty(t, buff.String(), "While running task-test-no-cmds-calls-chatty-silenced: Expected not to see output. While the task itself is not silenced, it does not have any cmds and only does an invocation of a silenced task.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A chatty task that does a silenced invocation of a task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-chatty-calls-silenced-cmd"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-chatty-calls-silenced-cmd"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Empty(t, buff.String(), "While running task-test-chatty-calls-silenced-cmd: Expected not to see output. While the task itself is not silenced, its call to the chatty task is silent.") | ||||
|  | ||||
| @@ -2121,21 +2121,21 @@ func TestSilence(t *testing.T) { | ||||
|  | ||||
| 	// Then test calls via dependencies. | ||||
| 	// A silent task that depends on a chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-is-silent-depends-on-chatty-non-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-is-silent-depends-on-chatty-non-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.NotEmpty(t, buff.String(), "While running task-test-is-silent-depends-on-chatty-non-silenced: Expected to see output. The task is silent and depends on a chatty task. Dependencies does not inherit silence.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A silent task that depends on a silenced chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-is-silent-depends-on-chatty-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-is-silent-depends-on-chatty-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Empty(t, buff.String(), "While running task-test-is-silent-depends-on-chatty-silenced: Expected not to see output. The task is silent and has a silenced dependency on a chatty task.") | ||||
|  | ||||
| 	buff.Reset() | ||||
|  | ||||
| 	// A chatty task that, depends on a silenced chatty task. | ||||
| 	err = e.Run(context.Background(), taskfile.Call{Task: "task-test-is-chatty-depends-on-chatty-silenced"}) | ||||
| 	err = e.Run(context.Background(), ast.Call{Task: "task-test-is-chatty-depends-on-chatty-silenced"}) | ||||
| 	require.NoError(t, err) | ||||
| 	require.Empty(t, buff.String(), "While running task-test-is-chatty-depends-on-chatty-silenced: Expected not to see output. The task is chatty but does not have commands and has a silenced dependency on a chatty task.") | ||||
|  | ||||
| @@ -2183,7 +2183,7 @@ func TestForce(t *testing.T) { | ||||
| 				ForceAll: tt.forceAll, | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
| 			require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "task-with-dep", Direct: true})) | ||||
| 			require.NoError(t, e.Run(context.Background(), ast.Call{Task: "task-with-dep", Direct: true})) | ||||
| 		}) | ||||
| 	} | ||||
| } | ||||
| @@ -2238,7 +2238,7 @@ func TestFor(t *testing.T) { | ||||
| 				Force:  true, | ||||
| 			} | ||||
| 			require.NoError(t, e.Setup()) | ||||
| 			require.NoError(t, e.Run(context.Background(), taskfile.Call{Task: test.name, Direct: true})) | ||||
| 			require.NoError(t, e.Run(context.Background(), ast.Call{Task: test.name, Direct: true})) | ||||
| 			assert.Equal(t, test.expectedOutput, buff.String()) | ||||
| 		}) | ||||
| 	} | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| // Call is the parameters to a task call | ||||
| type Call struct { | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| type Location struct { | ||||
| 	Line     int | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile_test | ||||
| package ast_test | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| @@ -7,7 +7,7 @@ import ( | ||||
| 	"github.com/stretchr/testify/require" | ||||
| 	"gopkg.in/yaml.v3" | ||||
| 
 | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
| 
 | ||||
| func TestPreconditionParse(t *testing.T) { | ||||
| @@ -18,29 +18,29 @@ func TestPreconditionParse(t *testing.T) { | ||||
| 	}{ | ||||
| 		{ | ||||
| 			"test -f foo.txt", | ||||
| 			&taskfile.Precondition{}, | ||||
| 			&taskfile.Precondition{Sh: `test -f foo.txt`, Msg: "`test -f foo.txt` failed"}, | ||||
| 			&ast.Precondition{}, | ||||
| 			&ast.Precondition{Sh: `test -f foo.txt`, Msg: "`test -f foo.txt` failed"}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			"sh: '[ 1 = 0 ]'", | ||||
| 			&taskfile.Precondition{}, | ||||
| 			&taskfile.Precondition{Sh: "[ 1 = 0 ]", Msg: "[ 1 = 0 ] failed"}, | ||||
| 			&ast.Precondition{}, | ||||
| 			&ast.Precondition{Sh: "[ 1 = 0 ]", Msg: "[ 1 = 0 ] failed"}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			` | ||||
| sh: "[ 1 = 2 ]" | ||||
| msg: "1 is not 2" | ||||
| `, | ||||
| 			&taskfile.Precondition{}, | ||||
| 			&taskfile.Precondition{Sh: "[ 1 = 2 ]", Msg: "1 is not 2"}, | ||||
| 			&ast.Precondition{}, | ||||
| 			&ast.Precondition{Sh: "[ 1 = 2 ]", Msg: "1 is not 2"}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			` | ||||
| sh: "[ 1 = 2 ]" | ||||
| msg: "1 is not 2" | ||||
| `, | ||||
| 			&taskfile.Precondition{}, | ||||
| 			&taskfile.Precondition{Sh: "[ 1 = 2 ]", Msg: "1 is not 2"}, | ||||
| 			&ast.Precondition{}, | ||||
| 			&ast.Precondition{Sh: "[ 1 = 2 ]", Msg: "1 is not 2"}, | ||||
| 		}, | ||||
| 	} | ||||
| 	for _, test := range tests { | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import "github.com/go-task/task/v3/internal/deepcopy" | ||||
| 
 | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -12,7 +12,7 @@ import ( | ||||
| 
 | ||||
| var V3 = semver.MustParse("3") | ||||
| 
 | ||||
| // Taskfile represents a Taskfile.yml | ||||
| // Taskfile is the abstract syntax tree for a Taskfile | ||||
| type Taskfile struct { | ||||
| 	Location string | ||||
| 	Version  *semver.Version | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile_test | ||||
| package ast_test | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| @@ -8,7 +8,7 @@ import ( | ||||
| 	"gopkg.in/yaml.v3" | ||||
| 
 | ||||
| 	"github.com/go-task/task/v3/internal/orderedmap" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
| 
 | ||||
| func TestCmdParse(t *testing.T) { | ||||
| @@ -31,16 +31,16 @@ vars: | ||||
| 	}{ | ||||
| 		{ | ||||
| 			yamlCmd, | ||||
| 			&taskfile.Cmd{}, | ||||
| 			&taskfile.Cmd{Cmd: `echo "a string command"`}, | ||||
| 			&ast.Cmd{}, | ||||
| 			&ast.Cmd{Cmd: `echo "a string command"`}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			yamlTaskCall, | ||||
| 			&taskfile.Cmd{}, | ||||
| 			&taskfile.Cmd{ | ||||
| 				Task: "another-task", Vars: &taskfile.Vars{ | ||||
| 			&ast.Cmd{}, | ||||
| 			&ast.Cmd{ | ||||
| 				Task: "another-task", Vars: &ast.Vars{ | ||||
| 					OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 						map[string]taskfile.Var{ | ||||
| 						map[string]ast.Var{ | ||||
| 							"PARAM1": {Value: "VALUE1"}, | ||||
| 							"PARAM2": {Value: "VALUE2"}, | ||||
| 						}, | ||||
| @@ -51,16 +51,16 @@ vars: | ||||
| 		}, | ||||
| 		{ | ||||
| 			yamlDeferredCmd, | ||||
| 			&taskfile.Cmd{}, | ||||
| 			&taskfile.Cmd{Cmd: "echo 'test'", Defer: true}, | ||||
| 			&ast.Cmd{}, | ||||
| 			&ast.Cmd{Cmd: "echo 'test'", Defer: true}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			yamlDeferredCall, | ||||
| 			&taskfile.Cmd{}, | ||||
| 			&taskfile.Cmd{ | ||||
| 				Task: "some_task", Vars: &taskfile.Vars{ | ||||
| 			&ast.Cmd{}, | ||||
| 			&ast.Cmd{ | ||||
| 				Task: "some_task", Vars: &ast.Vars{ | ||||
| 					OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 						map[string]taskfile.Var{ | ||||
| 						map[string]ast.Var{ | ||||
| 							"PARAM1": {Value: "var"}, | ||||
| 						}, | ||||
| 						[]string{"PARAM1"}, | ||||
| @@ -71,16 +71,16 @@ vars: | ||||
| 		}, | ||||
| 		{ | ||||
| 			yamlDep, | ||||
| 			&taskfile.Dep{}, | ||||
| 			&taskfile.Dep{Task: "task-name"}, | ||||
| 			&ast.Dep{}, | ||||
| 			&ast.Dep{Task: "task-name"}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			yamlTaskCall, | ||||
| 			&taskfile.Dep{}, | ||||
| 			&taskfile.Dep{ | ||||
| 				Task: "another-task", Vars: &taskfile.Vars{ | ||||
| 			&ast.Dep{}, | ||||
| 			&ast.Dep{ | ||||
| 				Task: "another-task", Vars: &ast.Vars{ | ||||
| 					OrderedMap: orderedmap.FromMapWithOrder( | ||||
| 						map[string]taskfile.Var{ | ||||
| 						map[string]ast.Var{ | ||||
| 							"PARAM1": {Value: "VALUE1"}, | ||||
| 							"PARAM2": {Value: "VALUE2"}, | ||||
| 						}, | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package taskfile | ||||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| import ( | ||||
| 	"crypto/sha256" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| import ( | ||||
| 	"os" | ||||
| @@ -8,10 +8,10 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/compiler" | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
| 
 | ||||
| func Dotenv(c *compiler.Compiler, tf *taskfile.Taskfile, dir string) (*taskfile.Vars, error) { | ||||
| func Dotenv(c *compiler.Compiler, tf *ast.Taskfile, dir string) (*ast.Vars, error) { | ||||
| 	if len(tf.Dotenv) == 0 { | ||||
| 		return nil, nil | ||||
| 	} | ||||
| @@ -21,7 +21,7 @@ func Dotenv(c *compiler.Compiler, tf *taskfile.Taskfile, dir string) (*taskfile. | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	env := &taskfile.Vars{} | ||||
| 	env := &ast.Vars{} | ||||
| 
 | ||||
| 	tr := templater.Templater{Vars: vars} | ||||
| 
 | ||||
| @@ -42,7 +42,7 @@ func Dotenv(c *compiler.Compiler, tf *taskfile.Taskfile, dir string) (*taskfile. | ||||
| 		} | ||||
| 		for key, value := range envs { | ||||
| 			if ok := env.Exists(key); !ok { | ||||
| 				env.Set(key, taskfile.Var{Value: value}) | ||||
| 				env.Set(key, ast.Var{Value: value}) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -3,13 +3,15 @@ package taskfile | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // NamespaceSeparator contains the character that separates namespaces | ||||
| const NamespaceSeparator = ":" | ||||
|  | ||||
| // Merge merges the second Taskfile into the first | ||||
| func Merge(t1, t2 *Taskfile, includedTaskfile *IncludedTaskfile, namespaces ...string) error { | ||||
| func Merge(t1, t2 *ast.Taskfile, includedTaskfile *ast.IncludedTaskfile, namespaces ...string) error { | ||||
| 	if !t1.Version.Equal(t2.Version) { | ||||
| 		return fmt.Errorf(`task: Taskfiles versions should match. First is "%s" but second is "%s"`, t1.Version, t2.Version) | ||||
| 	} | ||||
| @@ -18,15 +20,15 @@ func Merge(t1, t2 *Taskfile, includedTaskfile *IncludedTaskfile, namespaces ...s | ||||
| 	} | ||||
|  | ||||
| 	if t1.Vars == nil { | ||||
| 		t1.Vars = &Vars{} | ||||
| 		t1.Vars = &ast.Vars{} | ||||
| 	} | ||||
| 	if t1.Env == nil { | ||||
| 		t1.Env = &Vars{} | ||||
| 		t1.Env = &ast.Vars{} | ||||
| 	} | ||||
| 	t1.Vars.Merge(t2.Vars) | ||||
| 	t1.Env.Merge(t2.Env) | ||||
|  | ||||
| 	return t2.Tasks.Range(func(k string, v *Task) error { | ||||
| 	return t2.Tasks.Range(func(k string, v *ast.Task) error { | ||||
| 		// We do a deep copy of the task struct here to ensure that no data can | ||||
| 		// be changed elsewhere once the taskfile is merged. | ||||
| 		task := v.DeepCopy() | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| import ( | ||||
| 	"context" | ||||
| @@ -31,7 +31,7 @@ func NewNode( | ||||
| 		node, err = NewFileNode(uri, opts...) | ||||
| 	} | ||||
| 	if node.Remote() && !experiments.RemoteTaskfiles { | ||||
| 		return nil, errors.New("task: Remote taskfiles are not enabled. You can read more about this experiment and how to enable it at https://taskfile.dev/experiments/remote-taskfiles") | ||||
| 		return nil, errors.New("task: Remote taskfiles are not enabled. You can read more about this experiment and how to enable it at https://ast.dev/experiments/remote-taskfiles") | ||||
| 	} | ||||
| 	return node, err | ||||
| } | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| type ( | ||||
| 	NodeOption func(*BaseNode) | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| import ( | ||||
| 	"context" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| import ( | ||||
| 	"context" | ||||
| @@ -1,4 +1,4 @@ | ||||
| package read | ||||
| package taskfile | ||||
| 
 | ||||
| import ( | ||||
| 	"context" | ||||
| @@ -14,7 +14,7 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/internal/sysinfo" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
| 
 | ||||
| var ( | ||||
| @@ -40,7 +40,7 @@ func readTaskfile( | ||||
| 	timeout time.Duration, | ||||
| 	tempDir string, | ||||
| 	l *logger.Logger, | ||||
| ) (*taskfile.Taskfile, error) { | ||||
| ) (*ast.Taskfile, error) { | ||||
| 	var b []byte | ||||
| 	var err error | ||||
| 	var cache *Cache | ||||
| @@ -127,7 +127,7 @@ func readTaskfile( | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	var t taskfile.Taskfile | ||||
| 	var t ast.Taskfile | ||||
| 	if err := yaml.Unmarshal(b, &t); err != nil { | ||||
| 		return nil, &errors.TaskfileInvalidError{URI: filepathext.TryAbsToRel(node.Location()), Err: err} | ||||
| 	} | ||||
| @@ -136,10 +136,10 @@ func readTaskfile( | ||||
| 	return &t, nil | ||||
| } | ||||
| 
 | ||||
| // Taskfile reads a Taskfile for a given directory | ||||
| // Uses current dir when dir is left empty. Uses Taskfile.yml | ||||
| // or Taskfile.yaml when entrypoint is left empty | ||||
| func Taskfile( | ||||
| // Read reads a Read for a given directory | ||||
| // Uses current dir when dir is left empty. Uses Read.yml | ||||
| // or Read.yaml when entrypoint is left empty | ||||
| func Read( | ||||
| 	node Node, | ||||
| 	insecure bool, | ||||
| 	download bool, | ||||
| @@ -147,9 +147,9 @@ func Taskfile( | ||||
| 	timeout time.Duration, | ||||
| 	tempDir string, | ||||
| 	l *logger.Logger, | ||||
| ) (*taskfile.Taskfile, error) { | ||||
| 	var _taskfile func(Node) (*taskfile.Taskfile, error) | ||||
| 	_taskfile = func(node Node) (*taskfile.Taskfile, error) { | ||||
| ) (*ast.Taskfile, error) { | ||||
| 	var _taskfile func(Node) (*ast.Taskfile, error) | ||||
| 	_taskfile = func(node Node) (*ast.Taskfile, error) { | ||||
| 		t, err := readTaskfile(node, download, offline, timeout, tempDir, l) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| @@ -162,7 +162,7 @@ func Taskfile( | ||||
| 
 | ||||
| 		// Annotate any included Taskfile reference with a base directory for resolving relative paths | ||||
| 		if node, isFileNode := node.(*FileNode); isFileNode { | ||||
| 			_ = t.Includes.Range(func(key string, includedFile taskfile.IncludedTaskfile) error { | ||||
| 			_ = t.Includes.Range(func(key string, includedFile ast.IncludedTaskfile) error { | ||||
| 				// Set the base directory for resolving relative paths, but only if not already set | ||||
| 				if includedFile.BaseDir == "" { | ||||
| 					includedFile.BaseDir = node.Dir | ||||
| @@ -172,9 +172,9 @@ func Taskfile( | ||||
| 			}) | ||||
| 		} | ||||
| 
 | ||||
| 		err = t.Includes.Range(func(namespace string, includedTask taskfile.IncludedTaskfile) error { | ||||
| 		err = t.Includes.Range(func(namespace string, includedTask ast.IncludedTaskfile) error { | ||||
| 			tr := templater.Templater{Vars: t.Vars} | ||||
| 			includedTask = taskfile.IncludedTaskfile{ | ||||
| 			includedTask = ast.IncludedTaskfile{ | ||||
| 				Taskfile:       tr.Replace(includedTask.Taskfile), | ||||
| 				Dir:            tr.Replace(includedTask.Dir), | ||||
| 				Optional:       includedTask.Optional, | ||||
| @@ -227,14 +227,14 @@ func Taskfile( | ||||
| 				} | ||||
| 
 | ||||
| 				// nolint: errcheck | ||||
| 				includedTaskfile.Vars.Range(func(k string, v taskfile.Var) error { | ||||
| 				includedTaskfile.Vars.Range(func(k string, v ast.Var) error { | ||||
| 					o := v | ||||
| 					o.Dir = dir | ||||
| 					includedTaskfile.Vars.Set(k, o) | ||||
| 					return nil | ||||
| 				}) | ||||
| 				// nolint: errcheck | ||||
| 				includedTaskfile.Env.Range(func(k string, v taskfile.Var) error { | ||||
| 				includedTaskfile.Env.Range(func(k string, v ast.Var) error { | ||||
| 					o := v | ||||
| 					o.Dir = dir | ||||
| 					includedTaskfile.Env.Set(k, o) | ||||
| @@ -244,7 +244,7 @@ func Taskfile( | ||||
| 				for _, task := range includedTaskfile.Tasks.Values() { | ||||
| 					task.Dir = filepathext.SmartJoin(dir, task.Dir) | ||||
| 					if task.IncludeVars == nil { | ||||
| 						task.IncludeVars = &taskfile.Vars{} | ||||
| 						task.IncludeVars = &ast.Vars{} | ||||
| 					} | ||||
| 					task.IncludeVars.Merge(includedTask.Vars) | ||||
| 					task.IncludedTaskfileVars = includedTaskfile.Vars | ||||
| @@ -252,7 +252,7 @@ func Taskfile( | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			if err = taskfile.Merge(t, includedTaskfile, &includedTask, namespace); err != nil { | ||||
| 			if err = Merge(t, includedTaskfile, &includedTask, namespace); err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 
 | ||||
| @@ -273,7 +273,7 @@ func Taskfile( | ||||
| 		for _, task := range t.Tasks.Values() { | ||||
| 			// If the task is not defined, create a new one | ||||
| 			if task == nil { | ||||
| 				task = &taskfile.Task{} | ||||
| 				task = &ast.Task{} | ||||
| 			} | ||||
| 			// Set the location of the taskfile for each task | ||||
| 			if task.Location.Taskfile == "" { | ||||
							
								
								
									
										40
									
								
								variables.go
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								variables.go
									
									
									
									
									
								
							| @@ -12,27 +12,27 @@ import ( | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/internal/fingerprint" | ||||
| 	"github.com/go-task/task/v3/internal/templater" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| // CompiledTask returns a copy of a task, but replacing variables in almost all | ||||
| // properties using the Go template package. | ||||
| func (e *Executor) CompiledTask(call taskfile.Call) (*taskfile.Task, error) { | ||||
| func (e *Executor) CompiledTask(call ast.Call) (*ast.Task, error) { | ||||
| 	return e.compiledTask(call, true) | ||||
| } | ||||
|  | ||||
| // FastCompiledTask is like CompiledTask, but it skippes dynamic variables. | ||||
| func (e *Executor) FastCompiledTask(call taskfile.Call) (*taskfile.Task, error) { | ||||
| func (e *Executor) FastCompiledTask(call ast.Call) (*ast.Task, error) { | ||||
| 	return e.compiledTask(call, false) | ||||
| } | ||||
|  | ||||
| func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskfile.Task, error) { | ||||
| func (e *Executor) compiledTask(call ast.Call, evaluateShVars bool) (*ast.Task, error) { | ||||
| 	origTask, err := e.GetTask(call) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	var vars *taskfile.Vars | ||||
| 	var vars *ast.Vars | ||||
| 	if evaluateShVars { | ||||
| 		vars, err = e.Compiler.GetVariables(origTask, call) | ||||
| 	} else { | ||||
| @@ -44,7 +44,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
|  | ||||
| 	r := templater.Templater{Vars: vars} | ||||
|  | ||||
| 	new := taskfile.Task{ | ||||
| 	new := ast.Task{ | ||||
| 		Task:                 origTask.Task, | ||||
| 		Label:                r.Replace(origTask.Label), | ||||
| 		Desc:                 r.Replace(origTask.Desc), | ||||
| @@ -84,7 +84,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 		new.Prefix = new.Task | ||||
| 	} | ||||
|  | ||||
| 	dotenvEnvs := &taskfile.Vars{} | ||||
| 	dotenvEnvs := &ast.Vars{} | ||||
| 	if len(new.Dotenv) > 0 { | ||||
| 		for _, dotEnvPath := range new.Dotenv { | ||||
| 			dotEnvPath = filepathext.SmartJoin(new.Dir, dotEnvPath) | ||||
| @@ -97,28 +97,28 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 			} | ||||
| 			for key, value := range envs { | ||||
| 				if ok := dotenvEnvs.Exists(key); !ok { | ||||
| 					dotenvEnvs.Set(key, taskfile.Var{Value: value}) | ||||
| 					dotenvEnvs.Set(key, ast.Var{Value: value}) | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	new.Env = &taskfile.Vars{} | ||||
| 	new.Env = &ast.Vars{} | ||||
| 	new.Env.Merge(r.ReplaceVars(e.Taskfile.Env)) | ||||
| 	new.Env.Merge(r.ReplaceVars(dotenvEnvs)) | ||||
| 	new.Env.Merge(r.ReplaceVars(origTask.Env)) | ||||
| 	if evaluateShVars { | ||||
| 		err = new.Env.Range(func(k string, v taskfile.Var) error { | ||||
| 		err = new.Env.Range(func(k string, v ast.Var) error { | ||||
| 			// If the variable is not dynamic, we can set it and return | ||||
| 			if v.Value != nil || v.Sh == "" { | ||||
| 				new.Env.Set(k, taskfile.Var{Value: v.Value}) | ||||
| 				new.Env.Set(k, ast.Var{Value: v.Value}) | ||||
| 				return nil | ||||
| 			} | ||||
| 			static, err := e.Compiler.HandleDynamicVar(v, new.Dir) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 			new.Env.Set(k, taskfile.Var{Value: static}) | ||||
| 			new.Env.Set(k, ast.Var{Value: static}) | ||||
| 			return nil | ||||
| 		}) | ||||
| 		if err != nil { | ||||
| @@ -127,7 +127,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 	} | ||||
|  | ||||
| 	if len(origTask.Cmds) > 0 { | ||||
| 		new.Cmds = make([]*taskfile.Cmd, 0, len(origTask.Cmds)) | ||||
| 		new.Cmds = make([]*ast.Cmd, 0, len(origTask.Cmds)) | ||||
| 		for _, cmd := range origTask.Cmds { | ||||
| 			if cmd == nil { | ||||
| 				continue | ||||
| @@ -199,7 +199,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 					if len(keys) > 0 { | ||||
| 						extra["KEY"] = keys[i] | ||||
| 					} | ||||
| 					new.Cmds = append(new.Cmds, &taskfile.Cmd{ | ||||
| 					new.Cmds = append(new.Cmds, &ast.Cmd{ | ||||
| 						Cmd:         r.ReplaceWithExtra(cmd.Cmd, extra), | ||||
| 						Task:        r.ReplaceWithExtra(cmd.Task, extra), | ||||
| 						Silent:      cmd.Silent, | ||||
| @@ -213,7 +213,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 				} | ||||
| 				continue | ||||
| 			} | ||||
| 			new.Cmds = append(new.Cmds, &taskfile.Cmd{ | ||||
| 			new.Cmds = append(new.Cmds, &ast.Cmd{ | ||||
| 				Cmd:         r.Replace(cmd.Cmd), | ||||
| 				Task:        r.Replace(cmd.Task), | ||||
| 				Silent:      cmd.Silent, | ||||
| @@ -227,12 +227,12 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 		} | ||||
| 	} | ||||
| 	if len(origTask.Deps) > 0 { | ||||
| 		new.Deps = make([]*taskfile.Dep, 0, len(origTask.Deps)) | ||||
| 		new.Deps = make([]*ast.Dep, 0, len(origTask.Deps)) | ||||
| 		for _, dep := range origTask.Deps { | ||||
| 			if dep == nil { | ||||
| 				continue | ||||
| 			} | ||||
| 			new.Deps = append(new.Deps, &taskfile.Dep{ | ||||
| 			new.Deps = append(new.Deps, &ast.Dep{ | ||||
| 				Task:   r.Replace(dep.Task), | ||||
| 				Vars:   r.ReplaceVars(dep.Vars), | ||||
| 				Silent: dep.Silent, | ||||
| @@ -241,12 +241,12 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 	} | ||||
|  | ||||
| 	if len(origTask.Preconditions) > 0 { | ||||
| 		new.Preconditions = make([]*taskfile.Precondition, 0, len(origTask.Preconditions)) | ||||
| 		new.Preconditions = make([]*ast.Precondition, 0, len(origTask.Preconditions)) | ||||
| 		for _, precond := range origTask.Preconditions { | ||||
| 			if precond == nil { | ||||
| 				continue | ||||
| 			} | ||||
| 			new.Preconditions = append(new.Preconditions, &taskfile.Precondition{ | ||||
| 			new.Preconditions = append(new.Preconditions, &ast.Precondition{ | ||||
| 				Sh:  r.Replace(precond.Sh), | ||||
| 				Msg: r.Replace(precond.Msg), | ||||
| 			}) | ||||
| @@ -262,7 +262,7 @@ func (e *Executor) compiledTask(call taskfile.Call, evaluateShVars bool) (*taskf | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
| 			vars.Set(strings.ToUpper(checker.Kind()), taskfile.Var{Live: value}) | ||||
| 			vars.Set(strings.ToUpper(checker.Kind()), ast.Var{Live: value}) | ||||
| 		} | ||||
|  | ||||
| 		// Adding new variables, requires us to refresh the templaters | ||||
|   | ||||
							
								
								
									
										14
									
								
								watch.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								watch.go
									
									
									
									
									
								
							| @@ -15,13 +15,13 @@ import ( | ||||
| 	"github.com/go-task/task/v3/errors" | ||||
| 	"github.com/go-task/task/v3/internal/fingerprint" | ||||
| 	"github.com/go-task/task/v3/internal/logger" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| const defaultWatchInterval = 5 * time.Second | ||||
|  | ||||
| // watchTasks start watching the given tasks | ||||
| func (e *Executor) watchTasks(calls ...taskfile.Call) error { | ||||
| func (e *Executor) watchTasks(calls ...ast.Call) error { | ||||
| 	tasks := make([]string, len(calls)) | ||||
| 	for i, c := range calls { | ||||
| 		tasks[i] = c.Task | ||||
| @@ -119,24 +119,24 @@ func closeOnInterrupt(w *watcher.Watcher) { | ||||
| 	}() | ||||
| } | ||||
|  | ||||
| func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...taskfile.Call) error { | ||||
| func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...ast.Call) error { | ||||
| 	watchedFiles := w.WatchedFiles() | ||||
|  | ||||
| 	var registerTaskFiles func(taskfile.Call) error | ||||
| 	registerTaskFiles = func(c taskfile.Call) error { | ||||
| 	var registerTaskFiles func(ast.Call) error | ||||
| 	registerTaskFiles = func(c ast.Call) error { | ||||
| 		task, err := e.CompiledTask(c) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 		for _, d := range task.Deps { | ||||
| 			if err := registerTaskFiles(taskfile.Call{Task: d.Task, Vars: d.Vars}); err != nil { | ||||
| 			if err := registerTaskFiles(ast.Call{Task: d.Task, Vars: d.Vars}); err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 		} | ||||
| 		for _, c := range task.Cmds { | ||||
| 			if c.Task != "" { | ||||
| 				if err := registerTaskFiles(taskfile.Call{Task: c.Task, Vars: c.Vars}); err != nil { | ||||
| 				if err := registerTaskFiles(ast.Call{Task: c.Task, Vars: c.Vars}); err != nil { | ||||
| 					return err | ||||
| 				} | ||||
| 			} | ||||
|   | ||||
| @@ -17,7 +17,7 @@ import ( | ||||
|  | ||||
| 	"github.com/go-task/task/v3" | ||||
| 	"github.com/go-task/task/v3/internal/filepathext" | ||||
| 	"github.com/go-task/task/v3/taskfile" | ||||
| 	"github.com/go-task/task/v3/taskfile/ast" | ||||
| ) | ||||
|  | ||||
| func TestFileWatcherInterval(t *testing.T) { | ||||
| @@ -58,7 +58,7 @@ Hello, World! | ||||
| 			case <-ctx.Done(): | ||||
| 				return | ||||
| 			default: | ||||
| 				err := e.Run(ctx, taskfile.Call{Task: "default"}) | ||||
| 				err := e.Run(ctx, ast.Task: "default"}) | ||||
| 				if err != nil { | ||||
| 					return | ||||
| 				} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user