summaryrefslogtreecommitdiff
path: root/project/build/Comparator.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-12-08 16:52:53 -0800
committerPaul Phillips <paulp@improving.org>2011-12-08 16:56:06 -0800
commit8e709180304327fd07c741f9817bbc74adca584e (patch)
tree01f757f6b1366f4cbade455af02a7d3c6176a685 /project/build/Comparator.scala
parenta8da940cb62d7a57ef4d405a176223c02479c779 (diff)
downloadscala-8e709180304327fd07c741f9817bbc74adca584e.tar.gz
scala-8e709180304327fd07c741f9817bbc74adca584e.tar.bz2
scala-8e709180304327fd07c741f9817bbc74adca584e.zip
Deleted the sbt 0.7 project.
Pretty sure nobody's using this? Let's make some space for our upcoming friend the 0.11 project.
Diffstat (limited to 'project/build/Comparator.scala')
-rw-r--r--project/build/Comparator.scala72
1 files changed, 0 insertions, 72 deletions
diff --git a/project/build/Comparator.scala b/project/build/Comparator.scala
deleted file mode 100644
index 7400788ba9..0000000000
--- a/project/build/Comparator.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-import sbt._
-import java.io.{File, FileInputStream}
-
-// Based on scala.tools.ant.Same
-object Comparator {
-
- private def getMappedPath(path: Path, baseDirectory: Path): Path = {
- Path.fromString(baseDirectory, path.relativePath)
- }
-
-
- def compare(origin: Path, dest: Path, filter: Path => PathFinder, log: Logger): Option[String] = {
- log.info("Comparing the contents of "+origin.absolutePath+ " with "+dest.absolutePath)
- var allEqualNow = true
-
- def reportDiff(f1: File, f2: File) = {
- allEqualNow = false
- log.error("File '" + f1 + "' is different from correspondant.")
- }
-
- def reportMissing(f1: File) = {
- allEqualNow = false
- log.error("File '" + f1 + "' has no correspondant.")
- }
-
-
-
- val originPaths = filter(origin).get
-
- val bufferSize = 1024
- val originBuffer = new Array[Byte](bufferSize)
- val destBuffer = new Array[Byte](bufferSize)
-
- for (originPath <- originPaths.filter(! _.isDirectory)){
- log.debug("origin :" + originPath.absolutePath)
- val destPath = getMappedPath(originPath, dest)
- log.debug("dest :" + destPath.absolutePath)
- var equalNow = true
- val originFile = originPath.asFile
- val destFile = destPath.asFile
-
- if (originFile.canRead && destFile.canRead) {
-
- val originStream = new FileInputStream(originFile)
- val destStream = new FileInputStream(destFile)
- var originRemaining = originStream.read(originBuffer)
- var destRemaining = destStream.read(destBuffer)
- while (originRemaining > 0 && equalNow) {
- if (originRemaining == destRemaining)
- for (idx <- 0 until originRemaining) {
- equalNow = equalNow && (originBuffer(idx) == destBuffer(idx))}
- else
- equalNow = false
- originRemaining = originStream.read(originBuffer)
- destRemaining = destStream.read(destBuffer)
- }
- if (destRemaining > 0) equalNow = false
-
- if (!equalNow) reportDiff(originFile, destFile)
-
- originStream.close
- destStream.close
-
- }
- else reportMissing(originFile)
-
- }
- if(allEqualNow) None else Some("There were differences between "+origin.absolutePath+ " and "+ dest.absolutePath)
- }
-
-
-}