in docgen/lib/render/enhanced.go [200:219]
func NewSingleRuntimeTask(task *proto.Task, runtime Runtime, document *Document) *SingleRuntimeTask {
result := &SingleRuntimeTask{&proto.Task{}, Runtime(runtime), document}
*result.Task = *task
result.Task.Instructions = make([]*proto.TaskInstruction, 0, len(task.Instructions))
for _, ins := range task.Instructions {
isApplicable := len(ins.ApplicableRuntimes) == 0
if len(ins.ApplicableRuntimes) > 0 {
for _, rt := range ins.ApplicableRuntimes {
if rt == proto.Runtime(runtime) {
isApplicable = true
break
}
}
}
if isApplicable {
result.Task.Instructions = append(result.Task.Instructions, ins)
}
}
return result
}