mirror of
https://github.com/go-task/task.git
synced 2025-11-25 22:32:55 +02:00
refactor isUpToDate()
This commit is contained in:
7
task.go
7
task.go
@@ -132,6 +132,12 @@ func (e *Executor) runDeps(ctx context.Context, task string) error {
|
|||||||
|
|
||||||
func (t *Task) isUpToDate(ctx context.Context) (bool, error) {
|
func (t *Task) isUpToDate(ctx context.Context) (bool, error) {
|
||||||
if len(t.Status) > 0 {
|
if len(t.Status) > 0 {
|
||||||
|
return t.isUpToDateStatus(ctx)
|
||||||
|
}
|
||||||
|
return t.isUpToDateTimestamp(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *Task) isUpToDateStatus(ctx context.Context) (bool, error) {
|
||||||
environ, err := t.getEnviron()
|
environ, err := t.getEnviron()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -151,6 +157,7 @@ func (t *Task) isUpToDate(ctx context.Context) (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Task) isUpToDateTimestamp(ctx context.Context) (bool, error) {
|
||||||
if len(t.Sources) == 0 || len(t.Generates) == 0 {
|
if len(t.Sources) == 0 || len(t.Generates) == 0 {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user