From 16afe41cc17e2842074c76f34c39cf4a8b429da8 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Mon, 4 Feb 2019 20:28:45 -0800 Subject: [PATCH] Don't try to stamp files that don't exist This was causing slowdowns in windows. --- main-command/src/main/scala/sbt/Stamped.scala | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main-command/src/main/scala/sbt/Stamped.scala b/main-command/src/main/scala/sbt/Stamped.scala index cf8f63e55..8e3f5fa26 100644 --- a/main-command/src/main/scala/sbt/Stamped.scala +++ b/main-command/src/main/scala/sbt/Stamped.scala @@ -11,7 +11,7 @@ import java.io.{ File => JFile } import java.nio.file.Path import sbt.internal.FileCacheEntry -import sbt.internal.inc.Stamper +import sbt.internal.inc.{ EmptyStamp, Stamper } import sbt.io.TypedPath import xsbti.compile.analysis.Stamp @@ -47,13 +47,14 @@ private[sbt] object Stamped { * A combined convert that converts TypedPath instances representing *.jar and *.class files * using the last modified time and all other files using the file hash. */ - val converter: TypedPath => Stamp = (tp: TypedPath) => - if (tp.isDirectory) binaryConverter(tp) - else { - tp.toPath.toString match { - case s if s.endsWith(".jar") => binaryConverter(tp) - case s if s.endsWith(".class") => binaryConverter(tp) - case _ => sourceConverter(tp) + val converter: TypedPath => Stamp = (_: TypedPath) match { + case typedPath if !typedPath.exists => EmptyStamp + case typedPath if typedPath.isDirectory => binaryConverter(typedPath) + case typedPath => + typedPath.toPath.toString match { + case s if s.endsWith(".jar") => binaryConverter(typedPath) + case s if s.endsWith(".class") => binaryConverter(typedPath) + case _ => sourceConverter(typedPath) } }