sbt - How to use single input for multiple dependent input task -
i have issue have been working on 2 days straight no luck. have 2 task, package , deploy both change depending on environment being deployed to. using sbt-native-packager plugin packaging , sbt-deploy-ssh deployment.
my package task gets called inputtask so: bundle "env"
lazy val setenv : def.initialize[inputtask[string]] = def.inputtask { sbt.def.spacedelimited("<arg>").parsed(0) } lazy val configure : def.initialize[inputtask[string]] = def.inputtask { val env = setenv.evaluated writeconfig(env) env } lazy val bundle = inputkey[unit]("bundles project specific env") bundle := configure.parsed.flatmap { _ => (packagebin in config("universal")).taskvalue }.value
my deploy task gets called inputtask so: deployto "env"
val deployto = inputkey[unit]("deploys specific env") deployto := def.inputtaskdyn { val args = sbt.def.spacedelimited("<args>").parsed deploywithdynamicservers(getservers(args(0))) }.evaluated def deploywithdynamicservers(servers: seq[string]) = def.taskdyn { deployssh.totaks(" " + servers.mkstring(" ")) }
i can run both of these individually, want deploy task dependent on package task. want able run deployto , have supplied env passed package task well.
so far haven't had luck because keep getting "illegal dynamic reference errors" though both package , deploy task def.inputtaksdyn
just add env deployconfigs
deployconfigs ++= seq( serverconfig("env", "169.254.0.2") )
add artifact deployartifacts
deployartifacts ++= seq( artifactssh((packagebin in config("universal")).value, "/tmp/") )
and start deploy deployssh
.
deployssh yourservername1 yourservername2 ...
Comments
Post a Comment