How can I get the value of a setting (say, name
) and pass it as an argument to fullRunTask
? I do not understand the implementation of fullRunTask
.
For example:
lazy val foo = TaskKey[Unit]("foo")
fullRunTask(foo, Compile, "foo.Foo", name.value)
does not work because I can't reference name.value
in this context.
Ok I got some help from Josh Suereth. Doing this with fullRunTask
is a little more complex but the extra stuff it does (adding runner in myTask
) does wasn't really necessary. Inlining the body of runTask
did what I needed.
lazy val myTask = taskKey[Unit]("my custom run task")
myTask := {
val r = (runner in Compile).value
val input = name.value // or any other string setting(s)
val cp = (fullClasspath in Compile).value
toError(r.run("my.MainClass", data(cp), Seq(input), streams.value.log))
}
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