sbt - How to parallellize tasks given on the command line -
i'd able execute dynamically tasks in sbt.
so, i'm using command line:
sbt taska taskb taskc
it works ok, of them executed sequentially.
on other hand, if programmatically write inside build.sbt
:
val alltasks = taskkey[unit]("all") alltasks := { taska.value taskb.value taskc.value }
all of them executed in parallel.
how can behavior on command line?
you can use all
command:
build.sbt
taskkey[string]("taska") := { println("a start"); thread.sleep(3000); println("a end"); "a" } taskkey[string]("taskb") := { println("b start"); thread.sleep(2000); println("b end"); "b" } taskkey[string]("taskc") := { println("c start"); thread.sleep(1000); println("c end"); "c" }
and running it:
> taska taskb taskc c start start b start c end b end end
Comments
Post a Comment