Last active
August 29, 2015 13:59
-
-
Save jsuereth/10685530 to your computer and use it in GitHub Desktop.
sbt incremental task example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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