Last active
October 6, 2017 07:25
-
-
Save dwijnand/91f599f7d68056fa9e33f32c5b5a12e4 to your computer and use it in GitHub Desktop.
Stick it in ~/.sbt/0.13/reload.sbt
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
def buildFiles(b: File) = ((b * "*.sbt") +++ ((b / "project") ** ("*.scala" | "*.sbt")) filter (_.isFile)) | |
def genBuildFilesHashesAt(base: File) = buildFiles(base).get.map(f => f -> (Hash toHex Hash(f))).toMap | |
def genBuildFilesHashes(units: Map[URI, LoadedBuildUnit]) = | |
(units.values flatMap (_.defined) map (_._2.base) flatMap genBuildFilesHashesAt).toMap.## | |
val buildFilesHashes = settingKey[Int]("") in Global | |
buildFilesHashes := genBuildFilesHashes(loadedBuild.value.units) | |
shellPrompt in Global := (s => | |
"%s> ".format( | |
if (genBuildFilesHashes(Project structure s units) == buildFilesHashes.value) "" | |
else scala.Console.RED + "RELOAD " + scala.Console.RESET | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have a SBT-1.0 version of this available?