mirror of
https://github.com/go-task/task.git
synced 2025-06-17 00:17:51 +02:00
feat: support refs in dependencies
This commit is contained in:
11
variables.go
11
variables.go
@ -234,6 +234,17 @@ func (e *Executor) compiledTask(call ast.Call, evaluateShVars bool) (*ast.Task,
|
||||
newDep := dep.DeepCopy()
|
||||
newDep.Task = r.Replace(dep.Task)
|
||||
newDep.Vars = r.ReplaceVars(dep.Vars)
|
||||
// Loop over the dep's variables and resolve any references to other variables
|
||||
err := dep.Vars.Range(func(k string, v ast.Var) error {
|
||||
if v.Ref != "" {
|
||||
refVal := vars.Get(v.Ref)
|
||||
newDep.Vars.Set(k, refVal)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
new.Deps = append(new.Deps, newDep)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user