kiiadi
kiiadi

Reputation: 401

Run SBT command from task

Is it possible to run an SBT command (that's defined in my build.sbt) from a task (that's also defined in my build.sbt) ?

Alternatively can I add a command as a dependency to a task (ie: I want to run a command before I compile).

Upvotes: 2

Views: 1583

Answers (3)

e-orz
e-orz

Reputation: 41

Command.process("you_command", state.value)

The process method is back from version 1.2.0. But, it won't change the whole state just run the command and return a new state.

Upvotes: 2

Cause Chung
Cause Chung

Reputation: 1485

In sbt 1.0 Command.process has been dropped. Use insertion or appending to add command to state as below:

  val insertCommand: State => State =
    (state: State) =>
      state.copy(remainingCommands = Exec("some-command", None) +: state.remainingCommands)

see http://www.scala-sbt.org/1.0/docs/Build-State.html

Upvotes: 3

chengpohi
chengpohi

Reputation: 14217

Command.process("you_command", state.value)

use Command.process to call your custom command

Upvotes: 3

Related Questions