Skip to content

Commit

Permalink
Merge pull request #1 from dwijnand/wip-milli
Browse files Browse the repository at this point in the history
Use IO.getModified over importing the method
  • Loading branch information
cunei authored Dec 15, 2017
2 parents 422340c + 6cebf6e commit 717b248
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import java.lang.ref.{ Reference, SoftReference }
import java.io.File
import java.net.URLClassLoader
import java.util.HashMap
import sbt.io.IO.getModifiedTime
import sbt.io.IO

// Hack for testing only
final class ClassLoaderCache(val commonParent: ClassLoader) {
Expand Down Expand Up @@ -44,7 +44,7 @@ final class ClassLoaderCache(val commonParent: ClassLoader) {
mkLoader: () => ClassLoader
): ClassLoader =
synchronized {
val tstamps = files.map(getModifiedTime)
val tstamps = files.map(IO.getModifiedTime)
getFromReference(files, tstamps, delegate.get(files), mkLoader)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import java.io.{ File, IOException }
import java.util
import java.util.Optional

import sbt.io.{ Hash => IOHash }
import sbt.io.{ Hash => IOHash, IO }
import xsbti.compile.analysis.{ ReadStamps, Stamp }
import sbt.io.IO.getModifiedTime

import scala.collection.immutable.TreeMap
import scala.util.matching.Regex
Expand Down Expand Up @@ -143,7 +142,7 @@ object Stamper {
}

val forHash = (toStamp: File) => tryStamp(Hash.ofFile(toStamp))
val forLastModified = (toStamp: File) => tryStamp(new LastModified(getModifiedTime(toStamp)))
val forLastModified = (toStamp: File) => tryStamp(new LastModified(IO.getModifiedTime(toStamp)))
}

object Stamps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.nio.file.attribute.{ BasicFileAttributes, FileTime }

import xsbti.compile.FileHash
import sbt.internal.inc.{ EmptyStamp, Stamper }
import sbt.io.IO.getModifiedTime
import sbt.io.IO

object ClasspathCache {
// For more safety, store both the time and size
Expand All @@ -30,7 +30,7 @@ object ClasspathCache {
val attrs = Files.readAttributes(file.toPath, classOf[BasicFileAttributes])
if (attrs.isDirectory) emptyFileHash(file)
else {
val currentMetadata = (FileTime.fromMillis(getModifiedTime(file)), attrs.size())
val currentMetadata = (FileTime.fromMillis(IO.getModifiedTime(file)), attrs.size())
Option(cacheMetadataJar.get(file)) match {
case Some((metadata, hashHit)) if metadata == currentMetadata => hashHit
case _ => genFileHash(file, currentMetadata)
Expand Down

0 comments on commit 717b248

Please sign in to comment.