IntegrationTest settings should be compatible/friendly for AutoPlugin usage
I am trying to write an AutoPlugin that provides some source generation in IntegrationTest configuration. The task added by the AutoPlugin gets removed. Here is a minimum Build.scala needed to reproduce the problem
import sbt.Keys._
import sbt._
object TestP extends AutoPlugin {
override def requires = JvmPlugin
override def projectSettings: Seq[Setting[_]] = Seq(
sourceGenerators in IntegrationTest <+= Def.task {
println("source generated in plugin")
Nil
}
)
}
object Build extends Build {
lazy val test123 = Project(id = "test123", base = file("."))
.configs(IntegrationTest)
.enablePlugins(TestP)
.settings(Defaults.itSettings: _*)
.settings(sourceGenerators in IntegrationTest <+= Def.task {
println("source generated in settings")
Nil
})
}
Produces
4:09 $ sbt it:test
[info] Loading project definition from /Users/user/code/test123/project
[info] Set current project to test123 (in build file:/Users/user/code/test123/)
source generated in settings
[success] Total time: 0 s, completed Jul 21, 2015 4:09:32 PM
If you look at the second last line it only prints out "source generated in settings" but not the "source generated in plugin".
The issue is actually in Defaults.itSettings. These are added after the autoplugin settings, and the notion of "itSettings" should probably be translated into Autoplugins, so you can depend on their existence. The workaround right would be to put the itSettings into your autoplugin and not specify them manually on projects.
Going to retitle this.
I am closing this due to inactivity, and also there's a workaround posted.
I'm facing the same problem.. are you going to do something with this?
I'll reopen this. Would you like to try for a pull request on this? I think the first step would be to make a plugin under https://github.com/sbt/sbt/tree/develop/main/src/main/scala/sbt/plugins.