mirror of https://github.com/sbt/sbt.git
Convert lastModified/setLastModified calls to sbt.io.Milli calls (more precise)
This commit is contained in:
parent
858f918a19
commit
ca2617e99e
|
|
@ -2,6 +2,7 @@ package sbt
|
|||
package librarymanagement
|
||||
|
||||
import java.io.File
|
||||
import sbt.io.Milli.getModifiedTime
|
||||
|
||||
/**
|
||||
* Provides extra methods for filtering the contents of an `UpdateReport`
|
||||
|
|
@ -10,7 +11,7 @@ import java.io.File
|
|||
final class RichUpdateReport(report: UpdateReport) {
|
||||
private[sbt] def recomputeStamps(): UpdateReport = {
|
||||
val files = report.cachedDescriptor +: allFiles
|
||||
val stamps = files.map(f => (f, f.lastModified)).toMap
|
||||
val stamps = files.map(f => (f, getModifiedTime(f))).toMap
|
||||
UpdateReport(report.cachedDescriptor, report.configurations, report.stats, stamps)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import org.apache.ivy.util.{ CopyProgressEvent, CopyProgressListener, Message }
|
|||
import org.apache.ivy.util.url.{ AbstractURLHandler, BasicURLHandler, IvyAuthenticator, URLHandler }
|
||||
import org.apache.ivy.util.url.URLHandler._
|
||||
import sbt.io.IO
|
||||
import sbt.io.Milli.setModifiedTime
|
||||
|
||||
// Copied from Ivy's BasicURLHandler.
|
||||
class GigahorseUrlHandler extends AbstractURLHandler {
|
||||
|
|
@ -149,7 +150,7 @@ class GigahorseUrlHandler extends AbstractURLHandler {
|
|||
|
||||
val lastModified = lastModifiedTimestamp(response)
|
||||
if (lastModified > 0) {
|
||||
dest.setLastModified(lastModified)
|
||||
setModifiedTime(dest, lastModified)
|
||||
}
|
||||
|
||||
if (l != null) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ object Util {
|
|||
val timestamp = formatter.format(new Date)
|
||||
val content = versionLine(version) + "\ntimestamp=" + timestamp
|
||||
val f = dir / "xsbt.version.properties"
|
||||
// TODO: replace lastModified() with sbt.io.Milli.getModifiedTime(), once the build
|
||||
// has been upgraded to a version of sbt that includes sbt.io.Milli.
|
||||
if (!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)) {
|
||||
s.log.info("Writing version information to " + f + " :\n" + content)
|
||||
IO.write(f, content)
|
||||
|
|
|
|||
Loading…
Reference in New Issue