Roll back the use of sbt/serialization for update caching

This commit is contained in:
Eugene Yokota 2015-03-10 05:12:17 -04:00
parent 4eff1d0262
commit 1891b52472
2 changed files with 4 additions and 3 deletions

View File

@ -38,7 +38,8 @@ object Tracked {
toFile(next)(cacheFile)
next
}
private[sbt] def lastOuputWithJson[I, O: Pickler: Unpickler](cacheFile: File)(f: (I, Option[O]) => O): I => O = in =>
// Todo: This function needs more testing.
private[sbt] def lastOutputWithJson[I, O: Pickler: Unpickler](cacheFile: File)(f: (I, Option[O]) => O): I => O = in =>
{
val previous: Option[O] = try {
fromJsonFile[O](cacheFile).toOption

View File

@ -1388,13 +1388,13 @@ object Classpaths {
val outCacheFile = cacheFile / "output"
def skipWork: In => UpdateReport =
Tracked.lastOuputWithJson[In, UpdateReport](outCacheFile) {
Tracked.lastOutput[In, UpdateReport](outCacheFile) {
case (_, Some(out)) => out
case _ => sys.error("Skipping update requested, but update has not previously run successfully.")
}
def doWork: In => UpdateReport =
Tracked.inputChanged(cacheFile / "inputs") { (inChanged: Boolean, in: In) =>
val outCache = Tracked.lastOuputWithJson[In, UpdateReport](outCacheFile) {
val outCache = Tracked.lastOutput[In, UpdateReport](outCacheFile) {
case (_, Some(out)) if uptodate(inChanged, out) => out
case _ => work(in)
}