In sbt 0,13 und die neuesten Versionen der Anwendungsfall kann auch mit :=
und .value
Makros erreicht werden (die beide zielen auf sein einfacher als <<=
):
doc in Compile := {
val f = (doc in Compile).value
// execute a shell script if you want with sbt's Process API
// http://www.scala-sbt.org/0.13/docs/Process.html
val ec = (baseDirectory.value/"myBashScript.sh").getAbsolutePath !
val log = streams.value.log
log.debug(s"Exit code: $ec")
f
}
Sie können auch mögen triggeredBy
Methode für Aufgaben wie folgt:
lazy val runMyBashScriptTask = taskKey[Unit]("Run myBashScript")
runMyBashScriptTask := {
val ec = (baseDirectory.value/"myBashScript.sh").getAbsolutePath !
val log = streams.value.log
log.debug(s"Exit code: $ec")
}
runMyBashScriptTask <<= runMyBashScriptTask triggeredBy (doc in Compile)
Er geht davon aus, dass myBashScript.sh
im Hauptverzeichnis des Projektes ist es, wie durch baseDirectory
Einstellung hingewiesen.