diff --git a/project/Sbt.scala b/project/Sbt.scala index 0af48a1d2..48e3dc07b 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -29,7 +29,7 @@ object Sbt extends Build { javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"), incOptions := incOptions.value.withNameHashing(true), commands += Command.command("setupBuildScala211") { state => - """set scalaVersion in ThisBuild := "2.11.0" """ :: + """set scalaVersion in ThisBuild := "2.11.1" """ :: "set Util.includeTestDependencies in ThisBuild := true" :: state }, @@ -48,12 +48,12 @@ object Sbt extends Build { // TODO - To some extent these should take args to figure out what to do. commands += Command.command("release-libs-211") { state => "setupBuildScala211" :: - /// First test - lameAgregateTask("test") :: - // Note: You need the sbt-pgp plugin installed to release. - lameAgregateTask("publishSigned") :: - // Now restore the defaults. - "reload" :: state + /// First test + lameAgregateTask("test") :: + // Note: You need the sbt-pgp plugin installed to release. + lameAgregateTask("publishSigned") :: + // Now restore the defaults. + "reload" :: state }, commands += Command.command("release-sbt-local") { state => "publishLocal" :: diff --git a/util/classpath/src/main/scala/sbt/classpath/ClassLoaderCache.scala b/util/classpath/src/main/scala/sbt/classpath/ClassLoaderCache.scala index 3886fe4d5..2e489eb6f 100644 --- a/util/classpath/src/main/scala/sbt/classpath/ClassLoaderCache.scala +++ b/util/classpath/src/main/scala/sbt/classpath/ClassLoaderCache.scala @@ -5,6 +5,7 @@ import java.io.File import java.net.URLClassLoader import java.util.HashMap +// Hack for testing only private[sbt] final class ClassLoaderCache(val commonParent: ClassLoader) { private[this] val delegate = new HashMap[List[File], Reference[CachedClassLoader]] @@ -25,9 +26,9 @@ private[sbt] final class ClassLoaderCache(val commonParent: ClassLoader) { get(files, stamps, existingRef.get) private[this] def get(files: List[File], stamps: List[Long], existing: CachedClassLoader): ClassLoader = - if (existing == null || stamps != existing.timestamps) + if (existing == null || stamps != existing.timestamps) { newEntry(files, stamps) - else + } else existing.loader private[this] def newEntry(files: List[File], stamps: List[Long]): ClassLoader = diff --git a/util/classpath/src/test/scala/sbt/classpath/ConcurrentCache.scala b/util/classpath/src/test/scala/sbt/classpath/ConcurrentCache.scala deleted file mode 100644 index ab2fa9ac9..000000000 --- a/util/classpath/src/test/scala/sbt/classpath/ConcurrentCache.scala +++ /dev/null @@ -1,30 +0,0 @@ -package sbt -package classpath - -import org.scalacheck._ -import Prop._ -import java.io.File - -object ConcurrentCache extends Properties("ClassLoaderCache concurrent access") { - implicit lazy val concurrentArb: Arbitrary[Int] = Arbitrary(Gen.choose(1, 1000)) - implicit lazy val filenameArb: Arbitrary[String] = Arbitrary(Gen.alphaStr) - - property("Same class loader for same classpaths concurrently processed") = forAll { (names: List[String], concurrent: Int) => - withcp(names.distinct) { files => - val cache = new ClassLoaderCache(null) - val loaders = (1 to concurrent).par.map(_ => cache(files)).toList - sameClassLoader(loaders) - } - } - - private[this] def withcp[T](names: List[String])(f: List[File] => T): T = IO.withTemporaryDirectory { tmp => - val files = names.map { name => - val file = new File(tmp, name) - IO.touch(file) - file - } - f(files) - } - private[this] def sameClassLoader(loaders: Seq[ClassLoader]): Boolean = loaders.size < 2 || - loaders.sliding(2).forall { case Seq(x, y) => x == y } -} \ No newline at end of file