I am in the process of creating a plugin that will modify both the compile:compile and test:test tasks. My ultimate aim is to be able to do sbt monkjack
or sbt monkjack:test
(either is fine). In the compile:compile scope I need to add a compiler plugin, and in the test:test scope I need to run some code after the tests have finished.
My first attempts were around trying to create a custom configuration but which to extend, compile or test, was unclear as both are needed (At the moment I have two, and I copy the CustomTest into the CustomCompile and then run monkjack:test). My second attempts were focusing on a custom task that in turn invoked (compile in Compile).value and (test in Test).value after setting various options.
I realize my knowledge of SBT tasks and how they are related/inherited/scoped is not great.
Q1. Is there a chain of tasks like in maven? In maven if you execute test, it will execute the other phases in order. So mvn clean test will automatically run prepare-sources, compile, etc etc. So in SBT if I run sbt test
how are the other tasks automatically executed.
Q2. If you execute a task with a custom config, eg sbt millertime:test
will that config propagate to the other tasks that run. Eg, is this the same as sbt monkjack:compile monkjack:test
or the same as sbt compile monkjack:test
or neither :)
Q3. How do tasks know which is their default config? If I do sbt compile
how does SBT know that means sbt compile:compile
?
Q4. Which is the best way to go here, a custom configuration or a new task.