SBT 0.11 InputKey depending on other tasks

In 0.7.x we used dependsOn to declare that the task depends on other tasks - this means that you need to perform other tasks first.

In 0.11.x we use <<= to state that a task depends on some other task. The SBT quiz says a lot about how to declare TaskKey[_] , which depends on other tasks and settings (there are questions regarding it), but not so many InputKey[_] . If I have an input key declared as follows:

 val benchTask = InputKey[Unit]( "bench", "Runs a specified benchmark." ) <<= inputTask { (argTask: TaskKey[Seq[String]]) => argTask map { args => // ... } // xxx } 

How can I make it depend on other tasks like packageBin in Test ? I can put dependsOn instead of the xxx comment above, but this gives me type errors.

Thanks.

+4
source share
1 answer

Associate another task with argTask:

 inputTask { (argTask: TaskKey[Seq[String]]) => (argTask, packageBin in Test) map { (args, pb) => // ... } } 
+6
source

Source: https://habr.com/ru/post/1391402/


All Articles