I am able to automatically execute a task before compilation with:
compile in Compile <<= (compile in Compile).dependsOn(myTask)
How do I do the same but after compile?
I know I can do:
compile in Compile <<= (compile in Compile) map{x=>
// post-compile work
doFoo()
x
}
to execute arbitrary Scala code, but I need to automatically execute the target task itself when a compile event occurs
Doing something like:
val foo = TaskKey[Unit]("foo", "...")
val fooTask = foo <<= scalaInstance map {si =>
...
} dependsOn(compile in Compile)
works if I type "foo" from sbt> prompt; i.e. task is executed after compile, but the goal is to hook into compile task itself, so anytime a compilation occurs, the foo task is automatically called after compilation completes.
Is this possible, or am I going about things in the wrong way to hook into the built-in compile task?