mirror of https://github.com/sbt/sbt.git
Cache doc task
This commit is contained in:
parent
df1e038481
commit
69ae123fc8
|
|
@ -24,7 +24,7 @@ object CacheIO
|
||||||
fromFile[T](file) getOrElse default
|
fromFile[T](file) getOrElse default
|
||||||
def fromFile[T](file: File)(implicit format: Format[T], mf: Manifest[Format[T]]): Option[T] =
|
def fromFile[T](file: File)(implicit format: Format[T], mf: Manifest[Format[T]]): Option[T] =
|
||||||
try { Some( Operations.fromFile(file)(stampedFormat(format)) ) }
|
try { Some( Operations.fromFile(file)(stampedFormat(format)) ) }
|
||||||
catch { case e: FileNotFoundException => None }
|
catch { case e: Exception => None }
|
||||||
|
|
||||||
def toFile[T](format: Format[T])(value: T)(file: File)(implicit mf: Manifest[Format[T]]): Unit =
|
def toFile[T](format: Format[T])(value: T)(file: File)(implicit mf: Manifest[Format[T]]): Unit =
|
||||||
toFile(value)(file)(format, mf)
|
toFile(value)(file)(format, mf)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ object FileInfo
|
||||||
implicit val format: Format[F]
|
implicit val format: Format[F]
|
||||||
import Cache._
|
import Cache._
|
||||||
implicit def fileInfoEquiv: Equiv[F] = defaultEquiv
|
implicit def fileInfoEquiv: Equiv[F] = defaultEquiv
|
||||||
implicit def infoInputCache: InputCache[F] = basicInput
|
def infoInputCache: InputCache[F] = basicInput
|
||||||
implicit def fileInputCache: InputCache[File] = wrapIn[File,F]
|
implicit def fileInputCache: InputCache[File] = wrapIn[File,F]
|
||||||
}
|
}
|
||||||
object full extends Style
|
object full extends Style
|
||||||
|
|
@ -95,7 +95,7 @@ object FilesInfo
|
||||||
val manifest: Manifest[Format[FilesInfo[F]]]
|
val manifest: Manifest[Format[FilesInfo[F]]]
|
||||||
def empty: FilesInfo[F] = new FilesInfo[F](Set.empty)
|
def empty: FilesInfo[F] = new FilesInfo[F](Set.empty)
|
||||||
import Cache._
|
import Cache._
|
||||||
implicit def infosInputCache: InputCache[FilesInfo[F]] = basicInput
|
def infosInputCache: InputCache[FilesInfo[F]] = basicInput
|
||||||
implicit def filesInputCache: InputCache[Set[File]] = wrapIn[Set[File],FilesInfo[F]]
|
implicit def filesInputCache: InputCache[Set[File]] = wrapIn[Set[File],FilesInfo[F]]
|
||||||
implicit def filesInfoEquiv: Equiv[FilesInfo[F]] = defaultEquiv
|
implicit def filesInfoEquiv: Equiv[FilesInfo[F]] = defaultEquiv
|
||||||
}
|
}
|
||||||
|
|
@ -112,4 +112,9 @@ object FilesInfo
|
||||||
lazy val hash: Style { type F = HashFileInfo } = new BasicStyle(FileInfo.hash)
|
lazy val hash: Style { type F = HashFileInfo } = new BasicStyle(FileInfo.hash)
|
||||||
lazy val lastModified: Style { type F = ModifiedFileInfo } = new BasicStyle(FileInfo.lastModified)
|
lazy val lastModified: Style { type F = ModifiedFileInfo } = new BasicStyle(FileInfo.lastModified)
|
||||||
lazy val exists: Style { type F = PlainFileInfo } = new BasicStyle(FileInfo.exists)
|
lazy val exists: Style { type F = PlainFileInfo } = new BasicStyle(FileInfo.exists)
|
||||||
|
|
||||||
|
implicit def existsInputsCache: InputCache[FilesInfo[PlainFileInfo]] = exists.infosInputCache
|
||||||
|
implicit def hashInputsCache: InputCache[FilesInfo[HashFileInfo]] = hash.infosInputCache
|
||||||
|
implicit def modifiedInputsCache: InputCache[FilesInfo[ModifiedFileInfo]] = lastModified.infosInputCache
|
||||||
|
implicit def fullInputsCache: InputCache[FilesInfo[HashModifiedFileInfo]] = full.infosInputCache
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
import java.io.{File,IOException}
|
import java.io.File
|
||||||
import CacheIO.{fromFile, toFile}
|
import CacheIO.{fromFile, toFile}
|
||||||
import sbinary.{Format, JavaIO}
|
import sbinary.{Format, JavaIO}
|
||||||
import scala.reflect.Manifest
|
import scala.reflect.Manifest
|
||||||
|
|
@ -120,7 +120,7 @@ class Changed[O](val cacheFile: File)(implicit equiv: Equiv[O], format: Format[O
|
||||||
stream => equiv.equiv(value, format.reads(stream))
|
stream => equiv.equiv(value, format.reads(stream))
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
case _: IOException => false
|
case _: Exception => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
object Difference
|
object Difference
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue