Revert "Revert "Update testtool change detection""
This reverts commit e75b41aec1
.
This commit is contained in:
parent
f61f9dbe95
commit
186e9e70b6
1 changed files with 23 additions and 4 deletions
|
@ -15,8 +15,9 @@ const timeFormat = "02-01-2006 15:04"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
Task struct {
|
Task struct {
|
||||||
Name string `yaml:"task"`
|
Name string `yaml:"task"`
|
||||||
Score int `yaml:"score"`
|
Score int `yaml:"score"`
|
||||||
|
Watch []string `yaml:"watch"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Group struct {
|
Group struct {
|
||||||
|
@ -34,6 +35,16 @@ func (g Group) IsOpen() bool {
|
||||||
return time.Until(t) < 0
|
return time.Until(t) < 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d Deadlines) Tasks() []*Task {
|
||||||
|
var tasks []*Task
|
||||||
|
for _, g := range d {
|
||||||
|
for i := range g.Tasks {
|
||||||
|
tasks = append(tasks, &g.Tasks[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tasks
|
||||||
|
}
|
||||||
|
|
||||||
func (d Deadlines) FindTask(name string) (*Group, *Task) {
|
func (d Deadlines) FindTask(name string) (*Group, *Task) {
|
||||||
for _, g := range d {
|
for _, g := range d {
|
||||||
for _, t := range g.Tasks {
|
for _, t := range g.Tasks {
|
||||||
|
@ -80,11 +91,19 @@ func findChangedTasks(d Deadlines, files []string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, task := d.FindTask(components[0])
|
_, task := d.FindTask(components[0])
|
||||||
if task == nil {
|
if task != nil {
|
||||||
|
tasks[task.Name] = struct{}{}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks[task.Name] = struct{}{}
|
for _, task := range d.Tasks() {
|
||||||
|
for _, path := range task.Watch {
|
||||||
|
if components[0] == path {
|
||||||
|
tasks[task.Name] = struct{}{}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var l []string
|
var l []string
|
||||||
|
|
Loading…
Reference in a new issue