Created
October 9, 2015 04:27
-
-
Save purefn/540bea3d15c954d7281f to your computer and use it in GitHub Desktop.
This file contains 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
TaskKey[Unit]("cleanCompile") <<= { | |
import Step._ | |
val go = | |
for { | |
_ <- doClean | |
_ <- doCompile | |
} yield () | |
go.run | |
} |
This file contains 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 Keys._ | |
case class Step[A](run: Def.Initialize[Task[A]]) { | |
def map[B](f: A => B): Step[B] = | |
Step[B](Def.taskDyn { | |
Def.task { f(run.value) } | |
}) | |
def flatMap[B](f: A => Step[B]): Step[B] = | |
Step[B](Def.taskDyn { | |
f(run.value).run | |
}) | |
} | |
object Step { | |
val doClean = Step(Def.task(clean.value)) | |
val doCompile = Step(Def.task(compile.in(Compile).value)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment