axel22
axel22

Reputation: 32335

SBT 0.11 InputKey depending on other tasks

In 0.7.x we used dependsOn to declare that a task depends on other tasks - meaning other tasks have to be executed first.

In 0.11.x we use <<= to declare that a task depends on some other task. The SBT wiki says a lot on how to declare a TaskKey[_] which depends on other tasks and settings (there are questions here that deal with that), but not much on InputKey[_]. If I have an input key declared like this:

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 for example packageBin in Test? I can put dependsOn instead of the xxx comment above, but that gives me type errors.

Thank you.

Upvotes: 4

Views: 620

Answers (1)

venechka
venechka

Reputation: 1234

Map your other task together with argTask:

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

Upvotes: 6

Related Questions