mirror of https://github.com/sbt/sbt.git
Merge pull request #136 from cunei/wip-milliBis
Revert *ModifiedTime() calls to *lastModified*() calls
This commit is contained in:
commit
d242fac409
|
|
@ -69,7 +69,7 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
|
||||||
val pathA = fromString(a)
|
val pathA = fromString(a)
|
||||||
val pathB = fromString(b)
|
val pathB = fromString(b)
|
||||||
val isNewer = pathA.exists &&
|
val isNewer = pathA.exists &&
|
||||||
(!pathB.exists || IO.getModifiedTime(pathA) > IO.getModifiedTime(pathB))
|
(!pathB.exists || IO.getModifiedTimeOrZero(pathA) > IO.getModifiedTimeOrZero(pathB))
|
||||||
if (!isNewer) {
|
if (!isNewer) {
|
||||||
scriptError(s"$pathA is not newer than $pathB")
|
scriptError(s"$pathA is not newer than $pathB")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ object Dependencies {
|
||||||
val scala211 = "2.11.12"
|
val scala211 = "2.11.12"
|
||||||
val scala212 = "2.12.4"
|
val scala212 = "2.12.4"
|
||||||
|
|
||||||
private val ioVersion = "1.1.2"
|
private val ioVersion = "1.1.3"
|
||||||
|
|
||||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
sbt.version=1.0.0
|
sbt.version=1.0.4
|
||||||
|
|
|
||||||
|
|
@ -51,11 +51,6 @@ object FilesInfo {
|
||||||
|
|
||||||
object FileInfo {
|
object FileInfo {
|
||||||
|
|
||||||
// returns 0L if file does not exist
|
|
||||||
private def getModifiedTimeOrZero(file: File) =
|
|
||||||
try IO.getModifiedTime(file)
|
|
||||||
catch { case _: FileNotFoundException => 0L }
|
|
||||||
|
|
||||||
sealed trait Style {
|
sealed trait Style {
|
||||||
type F <: FileInfo
|
type F <: FileInfo
|
||||||
|
|
||||||
|
|
@ -95,7 +90,7 @@ object FileInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
implicit def apply(file: File): HashModifiedFileInfo =
|
implicit def apply(file: File): HashModifiedFileInfo =
|
||||||
FileHashModified(file.getAbsoluteFile, Hash(file).toList, getModifiedTimeOrZero(file))
|
FileHashModified(file.getAbsoluteFile, Hash(file).toList, IO.getModifiedTimeOrZero(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
object hash extends Style {
|
object hash extends Style {
|
||||||
|
|
@ -152,7 +147,7 @@ object FileInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
implicit def apply(file: File): ModifiedFileInfo =
|
implicit def apply(file: File): ModifiedFileInfo =
|
||||||
FileModified(file.getAbsoluteFile, getModifiedTimeOrZero(file))
|
FileModified(file.getAbsoluteFile, IO.getModifiedTimeOrZero(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
object exists extends Style {
|
object exists extends Style {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import sbt.io.IO
|
||||||
|
|
||||||
class FileInfoSpec extends UnitSpec {
|
class FileInfoSpec extends UnitSpec {
|
||||||
val file = new java.io.File(".").getAbsoluteFile
|
val file = new java.io.File(".").getAbsoluteFile
|
||||||
val fileInfo: ModifiedFileInfo = FileModified(file, IO.getModifiedTime(file))
|
val fileInfo: ModifiedFileInfo = FileModified(file, IO.getModifiedTimeOrZero(file))
|
||||||
val filesInfo = FilesInfo(Set(fileInfo))
|
val filesInfo = FilesInfo(Set(fileInfo))
|
||||||
|
|
||||||
it should "round trip" in assertRoundTrip(filesInfo)
|
it should "round trip" in assertRoundTrip(filesInfo)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue