val startServer = taskKey[Unit]("start server.")
val stopServer = taskKey[Unit]("stop server.")
val integrationTest = taskKey[Unit]("integration test.")
startServer := {
println("start")
IO.touch(file("server.txt"))
}
stopServer := {
println("stop")
IO.delete(file("server.txt"))
}
integrationTest := {
startServer.value
test.value
stopServer.value
}
integrationTest := ordered {
startServer.value
println("hola!")
test.value
stopServer.value
}
There is not. The macro is mainly just syntax and works with the previously existing methods. I'm pretty sure I emphasized these particular semantics in the changelog, but maybe not in the getting started guide. It is a syntax for applicative functors, not monads.
In the example below, `ordered` would not be a guarantee if it were built using existing functionality. If startServer depended on `test` for example, the order would be `test` and then `startServer` and the second `test` wouldn't do any work because it had already been added to the graph.
I've been trying to think of some new ordered-like primitive with the right semantics. The best I've come up with is something like `ordered` that just generates an error if they aren't executed in that order, such as in the example above.
integrationTest := ordered {
// setup
startServer.value
// middle
val n = name.value
val jn = (jarName in assembly).value
val v = version.value
doSomething(n, jn, v)
// teardown
stopServer.value
}
integrationTest := transaction {
startServer.value
} andThen {
val n = name.value
val jn = (jarName in assembly).value
val v = version.value
doSomething(n, jn, v)
} andThen {
stopServer.value
}
> This reminds me of [scheduling/concurrency control][1], which is what I am
> actually after.
Schedule is a much better word than ordered because "schedule" is closer to what happens. However, I still think you'd need to generate an error if things don't happen in the order you expect (stopServer happening before doSomething, for example).
integrationTest := transaction {
startServer.value
} andThen { _ =>
val n = name.value
val jn = (jarName in assembly).value
val v = version.value
doSomething(n, jn, v)
} andThen { _ =>
stopServer.value
}
val x1 = extracted.runTask(task1, state)._2
val x2 = extracted.runTask(task2(x1), state)._2
val x3 = extracted.runTask(task3(x2), state)._2
x3
By "off the grid with no dependencies" you mean nothing can depend on it, right? So, this is a new type of key. You'd probably want to be able to depend on it from other transactions, though?> So `integrationTest` task basically is off the grid with no dependencies,
> It's sort of like trying express semicolons in batch mode `sbt startServer;How does this new type of task integrate with aggregation? For example, the semicolon example starts three task executions independent of the number of subprojects, but the new task approach seems like it would run 3 task executions for each subproject.
> doSomeTask; stopServer` (or human typing those tasks from the shell).