summaryrefslogtreecommitdiff
path: root/project/Sametest.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-06-13 05:54:44 -0400
committerPaul Phillips <paulp@improving.org>2013-06-13 11:47:43 -0400
commit77bf3a09328709f702bc066fe93fc3e12cd64ba2 (patch)
treeee5f6b47e416b2a5c09cef0aa8ae4bdc42757599 /project/Sametest.scala
parent5345eb27373953a3c171a7e2f9ff302db9045d33 (diff)
downloadscala-77bf3a09328709f702bc066fe93fc3e12cd64ba2.tar.gz
scala-77bf3a09328709f702bc066fe93fc3e12cd64ba2.tar.bz2
scala-77bf3a09328709f702bc066fe93fc3e12cd64ba2.zip
Removed sbt build.
Difficult though it may be to accept, it must go. We couldn't keep it working with active maintenance; after eight months of neglect there is no chance. Nobody is working on it or using it. The code will remain in the history if anyone wants it. One of the most annoying experiences one can have when building a new project is finding out one has been fiddling with an abandoned build system which isn't even expected to work. Sometimes I check out a scala project and there is a build.xml, a pom.xml, and a project directory. We should not be among those who sow such build confusion.
Diffstat (limited to 'project/Sametest.scala')
-rw-r--r--project/Sametest.scala63
1 files changed, 0 insertions, 63 deletions
diff --git a/project/Sametest.scala b/project/Sametest.scala
deleted file mode 100644
index 6f12eb24b3..0000000000
--- a/project/Sametest.scala
+++ /dev/null
@@ -1,63 +0,0 @@
-import sbt._
-
-import Build._
-import Keys._
-
-// This code is adapted from scala.tools.ant.Same by Gilles Dubochet.
-object SameTest {
-
- def checkSameBinaryProjects(lhs: Project, rhs: Project): Project.Initialize[Task[Unit]] =
- (classDirectory in Compile in lhs, classDirectory in Compile in rhs,
- compile in Compile in lhs, compile in Compile in rhs, streams) map { (lhs,rhs, _, _, s) =>
- // Now we generate a complete set of relative files and then
- def relativeClasses(dir: File) = (dir ** "*.class").get.flatMap(IO.relativize(dir,_).toList)
- // This code adapted from SameTask in the compiler.
- def hasDifferentFiles(filePairs: Seq[(File,File)]): Boolean = {
- filePairs exists { case (a,b) =>
- if (!a.canRead || !b.canRead) {
- s.log.error("Either ["+a+"] or ["+b+"] is missing.")
- true
- } else {
- s.log.debug("Checking for binary differences in ["+a+"] against ["+b+"].")
- val diff = !checkSingleFilePair(a,b)
- if(diff) s.log.error("["+a+"] differs from ["+b+"]")
- diff
- }
- }
- }
- val allClassMappings = (relativeClasses(lhs) ++ relativeClasses(rhs)).distinct
- val comparisons = allClassMappings.map(f => new File(lhs, f) -> new File(rhs, f))
- val result = hasDifferentFiles(comparisons)
- if (result) error("Binary artifacts differ.")
- }
-
- val bufferSize = 1024
-
- // Tests whether two files are binary equivalents of each other.
- def checkSingleFilePair(originFile: File, destFile: File): Boolean = {
- Using.fileInputStream(originFile) { originStream =>
- Using.fileInputStream(destFile) { destStream =>
- val originBuffer = new Array[Byte](bufferSize)
- val destBuffer = new Array[Byte](bufferSize)
- var equalNow = true
- 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
- equalNow
- }
- }
- }
-
-
-}