fix dependsOn not propagating failures in dependencies

This commit is contained in:
Mark Harrah 2011-06-22 19:17:10 -04:00
parent 4921be04c8
commit d0e072aa14
4 changed files with 28 additions and 3 deletions

View File

@ -207,8 +207,7 @@ object Scoped
{
val in = KCons(scopedTask(scope, key), KList.fromList(tasks))
Apply.tasks(in) { kl =>
val KCons(h,t) = KList.kcons(kl)
h.dependsOn(t.toList :_*)
kl.head.dependsOn(kl.tail.toList :_*)
}
}
}

View File

@ -0,0 +1,17 @@
import sbt._
import Keys._
// tests that errors are properly propagated for dependsOn, map, and flatMap
object B extends Build
{
lazy val root = Project("root", file(".")) settings(
a <<= baseDirectory map (b => if( (b / "succeed").exists) () else error("fail")),
b <<= a.task(at => nop dependsOn(at) ),
c <<= a map { _ => () },
d <<= a flatMap { _ => task { () } }
)
lazy val a = TaskKey[Unit]("a")
lazy val b = TaskKey[Unit]("b")
lazy val c = TaskKey[Unit]("c")
lazy val d = TaskKey[Unit]("d")
}

View File

@ -0,0 +1,8 @@
-> a
-> b
-> c
$ touch succeed
> a
> b
> c

View File

@ -6,6 +6,7 @@ package std
import Types._
import Task._
import TaskExtra.allM
import Execute._
object Transform
@ -46,7 +47,7 @@ object Transform
case Pure(eval) => toNode(KNil)( _ => Right(eval()) )
case Mapped(in, f) => toNode(in)( right f )
case FlatMapped(in, f) => toNode(in)( left f )
case DependsOn(in, deps) => toNode(KList.fromList(deps))( _ => Left(in) )
case DependsOn(in, deps) => toNode(KList.fromList(deps))( ((_:Any) => Left(in)) allM )
case Join(in, f) => uniform(in)(f)
}
}