Port actions/depends-on

This commit is contained in:
Eugene Yokota 2016-03-29 00:06:48 -04:00
parent c60578e297
commit f0ed145058
2 changed files with 25 additions and 29 deletions

View File

@ -0,0 +1,25 @@
// tests that errors are properly propagated for dependsOn, map, and flatMap
lazy val root = (project in file(".")).
settings(
a <<= baseDirectory map (b => if( (b / "succeed").exists) () else sys.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")
lazy val input = (project in file("input")).
settings(
f <<= inputTask { _ map { args => if(args(0) == "succeed") () else sys.error("fail") } },
j := sys.error("j"),
g <<= f dependsOn(j),
h <<= f map { _ => IO.touch(file("h")) }
)
lazy val f = InputKey[Unit]("f")
lazy val g = InputKey[Unit]("g")
lazy val h = InputKey[Unit]("h")
lazy val j = TaskKey[Unit]("j")

View File

@ -1,29 +0,0 @@
import sbt._
import Keys._
import Import._
// 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 sys.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")
lazy val input = Project("input", file("input")) settings(
f <<= inputTask { _ map { args => if(args(0) == "succeed") () else sys.error("fail") } },
j := sys.error("j"),
g <<= f dependsOn(j),
h <<= f map { _ => IO.touch(file("h")) }
)
lazy val f = InputKey[Unit]("f")
lazy val g = InputKey[Unit]("g")
lazy val h = InputKey[Unit]("h")
lazy val j = TaskKey[Unit]("j")
}