Skip to content

Instantly share code, notes, and snippets.

@jsuereth
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save jsuereth/10685530 to your computer and use it in GitHub Desktop.

Select an option

Save jsuereth/10685530 to your computer and use it in GitHub Desktop.
sbt incremental task example
import sbt._
import sbinary._
import DefaultProtocol._
object Incremental {
val soupOfTheDay = taskKey[String]("Returns the soup of the day. If none is defined, asked for one and remembers until cleaned.")
val showMenu = taskKey[Unit]("Displays the menu")
def settings: Seq[Setting[_]] =
Seq(
soupOfTheDay := {
soupOfTheDay.previous match {
case Some(soup) => soup
case None =>
SimpleReader.readLine("Please enter next soup: ", None) getOrElse "Turtle Soup"
}
}
showMenu := {
val log = streams.value.log
log.info("-- Menu --")
log.info(s"Soup of the Day: ${soupOfTheDay.value}")
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment