Merge pull request #4594 from eatkins/file-cache-validation

Change default FileTree implementation
This commit is contained in:
eugene yokota 2019-04-01 23:45:09 -04:00 committed by GitHub
commit 8e1ebda36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ object FileTree {
private sealed trait CacheOptions private sealed trait CacheOptions
private case object NoCache extends CacheOptions private case object NoCache extends CacheOptions
private case object UseCache extends CacheOptions private case object UseCache extends CacheOptions
private case object LogDifferences extends CacheOptions private case object Validate extends CacheOptions
private def toPair( private def toPair(
filter: Entry[FileAttributes] => Boolean filter: Entry[FileAttributes] => Boolean
)(e: Entry[FileAttributes]): Option[(Path, FileAttributes)] = )(e: Entry[FileAttributes]): Option[(Path, FileAttributes)] =
@ -55,14 +55,14 @@ object FileTree {
private class CachingRepository(underlying: FileTreeRepository[FileAttributes]) private class CachingRepository(underlying: FileTreeRepository[FileAttributes])
extends Repository { extends Repository {
lazy val cacheOptions = System.getProperty("sbt.io.filecache") match { lazy val cacheOptions = System.getProperty("sbt.io.filecache") match {
case "false" => NoCache case "true" => UseCache
case "true" => UseCache case "validate" => Validate
case _ => LogDifferences case _ => NoCache
} }
override def get(key: Glob): Seq[(Path, FileAttributes)] = { override def get(key: Glob): Seq[(Path, FileAttributes)] = {
underlying.register(key) underlying.register(key)
cacheOptions match { cacheOptions match {
case LogDifferences => case Validate =>
val res = Repository.polling.get(key) val res = Repository.polling.get(key)
val filter = key.toEntryFilter val filter = key.toEntryFilter
val cacheRes = underlying val cacheRes = underlying