mirror of https://github.com/sbt/sbt.git
Add conversions from Init/+Task to Taskable
This commit is contained in:
parent
fdfdd1ca47
commit
722022ae97
|
|
@ -35,6 +35,16 @@ sealed trait Taskable[T] {
|
|||
def toTask: Initialize[Task[T]]
|
||||
}
|
||||
|
||||
sealed trait TaskableImplicits { self: Taskable.type =>
|
||||
implicit def fromInit[T](x: Initialize[T]): Taskable[T] =
|
||||
new Taskable[T] { def toTask = Def.toITask(x) }
|
||||
}
|
||||
|
||||
object Taskable extends TaskableImplicits {
|
||||
implicit def fromITask[T](x: Initialize[Task[T]]): Taskable[T] =
|
||||
new Taskable[T] { def toTask = x }
|
||||
}
|
||||
|
||||
/** A common type for SettingKey and TaskKey so that both can be used as inputs to tasks.*/
|
||||
sealed trait ScopedTaskable[T] extends Scoped with Taskable[T]
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,26 @@ class ClasspathsTest[T](
|
|||
settKey: SettingKey[Seq[T]],
|
||||
taskKey: TaskKey[Seq[T]],
|
||||
initVal: Initialize[Seq[T]],
|
||||
taskVal: Initialize[Task[Seq[T]]],
|
||||
) {
|
||||
|
||||
def testConcat() = {
|
||||
concat(settKey, settKey)
|
||||
concat(settKey, taskKey)
|
||||
concat(settKey, initVal)
|
||||
concat(settKey, taskVal)
|
||||
concat(taskKey, settKey)
|
||||
concat(taskKey, taskKey)
|
||||
concat(taskKey, initVal)
|
||||
concat(taskKey, taskVal)
|
||||
concat(initVal, settKey)
|
||||
concat(initVal, taskKey)
|
||||
concat(initVal, initVal)
|
||||
concat(initVal, taskVal)
|
||||
concat(taskVal, settKey)
|
||||
concat(taskVal, taskKey)
|
||||
concat(taskVal, initVal)
|
||||
concat(taskVal, taskVal)
|
||||
}
|
||||
|
||||
def testConcatSettings() = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue