Is it possible to get the re-start
(aka reStart) task to automatically run before I run the IntegrationTest target (it:test
)?
I thought this would do it:
test <<= (test in IntegrationTest) dependsOn reStart
However, I'm getting this error:
build.sbt:54: error: not found: value reStart
test <<= (test in IntegrationTest) dependsOn reStart
^
[error] Type error in expression
By adding import Revolver._
I got a bit further, but it still fails. Now I get a more descriptive error, however:
build.sbt:55: error: type mismatch;
found : sbt.InputKey[spray.revolver.AppProcess]
required: sbt.Scoped.AnyInitTask
(which expands to) sbt.Def.Initialize[sbt.Task[T]] forSome { type T }
test in IntegrationTest <<= (test in IntegrationTest) dependsOn reStart
Is there a way to get around that?
You can define special TaskKey
-typed task for that like this (working example):
lazy val reStart0 = TaskKey[AppProcess]("re-start-0")
lazy val emptyArgs = SettingKey[revolver.Actions.ExtraCmdLineOptions]("empty-args")
lazy val projectA = Project(
id = "hello-a",
base = file("./a"),
settings = Project.defaultSettings ++ Revolver.settings
).settings(
emptyArgs := revolver.Actions.ExtraCmdLineOptions(Nil, Nil),
reStart0 <<= {
(streams, Revolver.reLogTag, thisProjectRef, Revolver.reForkOptions, mainClass in Revolver.reStart, fullClasspath in Runtime, Revolver.reStartArgs, emptyArgs)
.map(revolver.Actions.restartApp)
.dependsOn(products in Compile)
}
)
lazy val projectB = Project(
id = "hello-b",
base = file("./b"),
settings = Project.defaultSettings ++ Revolver.settings ++ Defaults.itSettings)
.configs(IntegrationTest)
.settings(
test in (IntegrationTest) <<= (test in IntegrationTest).dependsOn(reStart0 in projectA)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With