forked from hubertp/xsbt
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failed task execution should still preserve State changes. Fixes sbt#804
- Loading branch information
Showing
5 changed files
with
74 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
sbt/src/sbt-test/actions/update-state-fail/project/Build.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
import sbt._ | |||
import Keys._ | |||
|
|||
object TestBuild extends Build | |||
{ | |||
lazy val akey = AttributeKey[Int]("TestKey") | |||
lazy val t = TaskKey[String]("test-task") | |||
lazy val check = InputKey[Unit]("check") | |||
lazy val root = Project("root", file(".")).aggregate(a, b).settings( | |||
check := checkState(checkParser.parsed, state.value) | |||
) | |||
|
|||
lazy val a = Project("a", file("a")).settings(t := error("Failing")) | |||
|
|||
lazy val b = Project("b", file("b")).settings(t <<= Def.task("").updateState(updater)) | |||
|
|||
def checkState(runs: Int, s: State) { | |||
val stored = s.get(akey).getOrElse(0) | |||
assert(stored == runs, "Expected " + runs + ", got " + stored) | |||
} | |||
|
|||
def updater(s: State, a: AnyRef): State = s.update(akey)(_.getOrElse(0) + 1) | |||
|
|||
import complete.DefaultParsers._ | |||
|
|||
lazy val checkParser = token(Space ~> IntBasic) | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
> check 0 | |||
-> test-task | |||
> check 1 | |||
-> test-task | |||
> check 2 | |||
> b/test-task | |||
> check 3 | |||
-> a/test-task | |||
> check 3 |