mirror of https://github.com/sbt/sbt.git
commit
df74f78300
|
|
@ -32,9 +32,12 @@ def commonSettings: Seq[Setting[_]] = Seq(
|
|||
|
||||
val mimaSettings = Def settings (
|
||||
mimaPreviousArtifacts := Set(
|
||||
organization.value % moduleName.value % "1.0.0"
|
||||
"1.0.0", "1.0.1", "1.0.2", "1.0.3",
|
||||
"1.1.0", "1.1.1",
|
||||
) map (version =>
|
||||
organization.value %% moduleName.value % version
|
||||
cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
lazy val utilRoot: Project = (project in file("."))
|
||||
|
|
@ -62,9 +65,7 @@ lazy val utilRoot: Project = (project in file("."))
|
|||
homepage := Some(url("https://github.com/sbt/util")),
|
||||
description := "Util module for sbt",
|
||||
scmInfo := Some(ScmInfo(url("https://github.com/sbt/util"), "git@github.com:sbt/util.git")),
|
||||
scalafmtOnCompile := true,
|
||||
scalafmtOnCompile in Sbt := false,
|
||||
scalafmtVersion := "1.2.0",
|
||||
)),
|
||||
commonSettings,
|
||||
name := "Util Root",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.io.File
|
|||
import sbt.io.{ IO, Path }
|
||||
import sbt.io.syntax._
|
||||
import Path._
|
||||
import sbt.io.IO
|
||||
|
||||
class FileCommands(baseDirectory: File) extends BasicStatementHandler {
|
||||
lazy val commands = commandMap
|
||||
|
|
@ -67,7 +68,8 @@ class FileCommands(baseDirectory: File) extends BasicStatementHandler {
|
|||
def newer(a: String, b: String): Unit = {
|
||||
val pathA = fromString(a)
|
||||
val pathB = fromString(b)
|
||||
val isNewer = pathA.exists && (!pathB.exists || pathA.lastModified > pathB.lastModified)
|
||||
val isNewer = pathA.exists &&
|
||||
(!pathB.exists || IO.getModifiedTimeOrZero(pathA) > IO.getModifiedTimeOrZero(pathB))
|
||||
if (!isNewer) {
|
||||
scriptError(s"$pathA is not newer than $pathB")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ object Dependencies {
|
|||
val scala211 = "2.11.12"
|
||||
val scala212 = "2.12.4"
|
||||
|
||||
private val ioVersion = "1.1.1"
|
||||
private val ioVersion = "1.1.3"
|
||||
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
sbt.version=1.0.0
|
||||
sbt.version=1.0.4
|
||||
|
|
|
|||
|
|
@ -1,4 +1,2 @@
|
|||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.3")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0")
|
||||
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.17")
|
||||
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.14")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.5")
|
||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.2")
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@
|
|||
package sbt.util
|
||||
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
import scala.util.control.NonFatal
|
||||
import sbt.io.Hash
|
||||
import sbt.io.{ Hash, IO }
|
||||
import sjsonnew.{ Builder, JsonFormat, Unbuilder, deserializationError }
|
||||
import CacheImplicits._
|
||||
|
||||
|
|
@ -49,6 +50,7 @@ object FilesInfo {
|
|||
}
|
||||
|
||||
object FileInfo {
|
||||
|
||||
sealed trait Style {
|
||||
type F <: FileInfo
|
||||
|
||||
|
|
@ -88,7 +90,7 @@ object FileInfo {
|
|||
}
|
||||
|
||||
implicit def apply(file: File): HashModifiedFileInfo =
|
||||
FileHashModified(file.getAbsoluteFile, Hash(file).toList, file.lastModified)
|
||||
FileHashModified(file.getAbsoluteFile, Hash(file).toList, IO.getModifiedTimeOrZero(file))
|
||||
}
|
||||
|
||||
object hash extends Style {
|
||||
|
|
@ -145,7 +147,7 @@ object FileInfo {
|
|||
}
|
||||
|
||||
implicit def apply(file: File): ModifiedFileInfo =
|
||||
FileModified(file.getAbsoluteFile, file.lastModified)
|
||||
FileModified(file.getAbsoluteFile, IO.getModifiedTimeOrZero(file))
|
||||
}
|
||||
|
||||
object exists extends Style {
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ package sbt.util
|
|||
import sjsonnew.shaded.scalajson.ast.unsafe._
|
||||
import sjsonnew._, support.scalajson.unsafe._
|
||||
import sbt.internal.util.UnitSpec
|
||||
import sbt.io.IO
|
||||
|
||||
class FileInfoSpec extends UnitSpec {
|
||||
val file = new java.io.File(".").getAbsoluteFile
|
||||
val fileInfo: ModifiedFileInfo = FileModified(file, file.lastModified())
|
||||
val fileInfo: ModifiedFileInfo = FileModified(file, IO.getModifiedTimeOrZero(file))
|
||||
val filesInfo = FilesInfo(Set(fileInfo))
|
||||
|
||||
it should "round trip" in assertRoundTrip(filesInfo)
|
||||
|
|
|
|||
Loading…
Reference in New Issue