I\'m moving an SBT plugin from 0.12
over to 0.13
. At various points in my plugin I schedule a dynamic set of tasks onto the SBT build graph.
You can use Def.taskDyn
, which provides the new syntax for flatMap
. The difference from Def.task
is that the expected return type is a task Initialize[Task[T]]
instead of just T
. Translating your example,
inParallel := parTask.value
def parTask = Def.taskDyn {
val t = times.value
ordinals.value.map(o => ordinalTask(o, t)).joinWith(_.join)
}
def ordinalTask(o: String, t: Int) = Def.task {
(0 until t).map(_ => o).mkString(",")
}