mirror of
https://github.com/go-task/task.git
synced 2025-08-08 22:36:57 +02:00
merge preconditions
This commit is contained in:
@ -40,6 +40,20 @@ func (p *Preconditions) DeepCopy() *Preconditions {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Preconditions) Merge(other *Preconditions) {
|
||||
if p == nil || p.Preconditions == nil || other == nil {
|
||||
return
|
||||
}
|
||||
|
||||
p.mutex.Lock()
|
||||
defer p.mutex.Unlock()
|
||||
|
||||
other.mutex.RLock()
|
||||
defer other.mutex.RUnlock()
|
||||
|
||||
p.Preconditions = append(p.Preconditions, deepcopy.Slice(other.Preconditions)...)
|
||||
}
|
||||
|
||||
func (p *Precondition) DeepCopy() *Precondition {
|
||||
if p == nil {
|
||||
return nil
|
||||
|
@ -65,7 +65,7 @@ func (t1 *Taskfile) Merge(t2 *Taskfile, include *Include) error {
|
||||
}
|
||||
t1.Vars.Merge(t2.Vars, include)
|
||||
t1.Env.Merge(t2.Env, include)
|
||||
// TODO:@vmaerten Merge precondition
|
||||
t1.Preconditions.Merge(t2.Preconditions)
|
||||
return t1.Tasks.Merge(t2.Tasks, include, t1.Vars)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user