1
0
mirror of https://github.com/go-task/task.git synced 2024-12-04 10:24:45 +02:00

Running deps first

This commit is contained in:
Sascha Andres 2017-03-05 10:15:49 +01:00
parent d8f9b0697d
commit 561c213a92

14
task.go
View File

@ -2,6 +2,7 @@ package task
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
@ -83,21 +84,22 @@ func RunTask(name string) error {
return &taskNotFoundError{name}
}
if !Force && isTaskUpToDate(t) {
log.Printf(`task: Task "%s" is up to date`, name)
return nil
}
vars, err := t.handleVariables()
if err != nil {
return &taskRunError{name, err}
}
for _, d := range t.Deps {
if err := RunTask(ReplaceVariables(d, vars)); err != nil {
return err
}
}
if !Force && isTaskUpToDate(t) {
log.Printf(`task: Task "%s" is up to date`, name)
return nil
}
for _, c := range t.Cmds {
// read in a each time, as a command could change a variable or it has been changed by a dependency
vars, err = t.handleVariables()