Merge remote-tracking branch 'upstream/0.13' into 0.13

This commit is contained in:
David Pratt 2014-06-09 13:56:16 -05:00
commit 6348c22251
4 changed files with 14 additions and 41 deletions

View File

@ -101,6 +101,7 @@ class StreamDumper(in: java.io.BufferedReader, out: java.io.PrintStream) extends
case null => ()
case line =>
out.println(line)
out.flush()
read()
}
read()
@ -112,7 +113,7 @@ class StreamDumper(in: java.io.BufferedReader, out: java.io.PrintStream) extends
// just wait a couple seconds to read more stuff if there is
// any stuff.
if (waitForErrors) {
endTime.set(System.currentTimeMillis + 2000)
endTime.set(System.currentTimeMillis + 5000)
// at this point we'd rather the dumper thread run
// before we check whether to sleep
Thread.`yield`()
@ -132,7 +133,8 @@ object ServerLauncher {
case None => throw new RuntimeException("Logic Failure: Attempting to start a server that isn't configured to be a server. Please report a bug.")
}
val launchConfig = java.io.File.createTempFile("sbtlaunch", "config")
launchConfig.deleteOnExit()
if (System.getenv("SBT_SERVER_SAVE_TEMPS") eq null)
launchConfig.deleteOnExit()
LaunchConfiguration.save(config, launchConfig)
val jvmArgs: List[String] = serverConfig.jvmArgs map readLines match {
case Some(args) => args

View File

@ -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" ::

View File

@ -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 =

View File

@ -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 }
}