mirror of https://github.com/sbt/sbt.git
fix task tests
This commit is contained in:
parent
b46eb41d6c
commit
e2b5ce374c
|
|
@ -92,7 +92,8 @@ object Task
|
|||
def dependsOn(tasks: Task[_]*): Task[S] = new DependsOn(in, tasks)
|
||||
}
|
||||
|
||||
implicit val taskToNode = new (Task ~> NodeT[Task]#Apply) {
|
||||
implicit val taskToNode = new NodeView[Task] {
|
||||
def inline[T](a: Task[T]): Option[() => T] = None
|
||||
def apply[T](t: Task[T]): Node[Task, T] = t match {
|
||||
case Pure(eval) => toNode[T, HNil](KNil, _ => Right(eval()) )
|
||||
case Mapped(in, f) => toNode(in, right ∙ f )
|
||||
|
|
@ -138,7 +139,6 @@ object Task
|
|||
def run[T](root: Task[T], checkCycles: Boolean, maxWorkers: Int): Result[T] =
|
||||
{
|
||||
val (service, shutdown) = CompletionService[Task[_], Completed](maxWorkers)
|
||||
|
||||
val x = new Execute[Task](checkCycles, Execute.noTriggers)(taskToNode)
|
||||
try { x.run(root)(service) } finally { shutdown() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ object TaskTest
|
|||
{
|
||||
val (service, shutdown) = completionService[Task[_],Completed](restrictions, (x: String) => System.err.println(x))
|
||||
|
||||
val x = new Execute[Task](checkCycles, Execute.noTriggers)(taskToNode)
|
||||
val x = new Execute[Task](checkCycles, Execute.noTriggers)(taskToNode(idK[Task]))
|
||||
try { x.run(root)(service) } finally { shutdown() }
|
||||
}
|
||||
def tryRun[T](root: Task[T], checkCycles: Boolean, restrictions: ConcurrentRestrictions[Task[_]]): T =
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ trait TypeFunctions
|
|||
implicit def toFn1[A,B](f: A => B): Fn1[A,B] = new Fn1[A,B] {
|
||||
def ∙[C](g: C => A) = f compose g
|
||||
}
|
||||
def idK[M[_]]: M ~> M = new (M ~> M) { def apply[T](m: M[T]): M[T] = m }
|
||||
|
||||
type Endo[T] = T=>T
|
||||
type ~>|[A[_],B[_]] = A ~> Compose[Option, B]#Apply
|
||||
|
|
|
|||
Loading…
Reference in New Issue