mirror of
https://github.com/go-task/task.git
synced 2025-11-06 09:09:13 +02:00
@@ -16,8 +16,9 @@ import (
|
||||
var _ compiler.Compiler = &CompilerV2{}
|
||||
|
||||
type CompilerV2 struct {
|
||||
Dir string
|
||||
Vars taskfile.Vars
|
||||
Dir string
|
||||
Taskvars taskfile.Vars
|
||||
TaskfileVars taskfile.Vars
|
||||
|
||||
Logger *logger.Logger
|
||||
|
||||
@@ -28,12 +29,15 @@ type CompilerV2 struct {
|
||||
// GetVariables returns fully resolved variables following the priority order:
|
||||
// 1. Task variables
|
||||
// 2. Call variables
|
||||
// 3. Taskvars file variables
|
||||
// 4. Environment variables
|
||||
// 3. Taskfile variables
|
||||
// 4. Taskvars file variables
|
||||
// 5. Environment variables
|
||||
func (c *CompilerV2) GetVariables(t *taskfile.Task, call taskfile.Call) (taskfile.Vars, error) {
|
||||
vr := varResolver{c: c, vars: compiler.GetEnviron()}
|
||||
vr.merge(c.Vars)
|
||||
vr.merge(c.Vars)
|
||||
vr.merge(c.Taskvars)
|
||||
vr.merge(c.Taskvars)
|
||||
vr.merge(c.TaskfileVars)
|
||||
vr.merge(c.TaskfileVars)
|
||||
vr.merge(call.Vars)
|
||||
vr.merge(call.Vars)
|
||||
vr.merge(t.Vars)
|
||||
|
||||
@@ -3,6 +3,7 @@ package taskfile
|
||||
// Taskfile represents a Taskfile.yml
|
||||
type Taskfile struct {
|
||||
Version string
|
||||
Vars Vars
|
||||
Tasks Tasks
|
||||
}
|
||||
|
||||
@@ -15,12 +16,14 @@ func (tf *Taskfile) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
|
||||
var taskfile struct {
|
||||
Version string
|
||||
Vars Vars
|
||||
Tasks Tasks
|
||||
}
|
||||
if err := unmarshal(&taskfile); err != nil {
|
||||
return err
|
||||
}
|
||||
tf.Version = taskfile.Version
|
||||
tf.Vars = taskfile.Vars
|
||||
tf.Tasks = taskfile.Tasks
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user