mirror of https://github.com/sbt/sbt.git
Merge remote-tracking branch 'upstream/0.13' into 0.13
This commit is contained in:
commit
6348c22251
|
|
@ -101,6 +101,7 @@ class StreamDumper(in: java.io.BufferedReader, out: java.io.PrintStream) extends
|
||||||
case null => ()
|
case null => ()
|
||||||
case line =>
|
case line =>
|
||||||
out.println(line)
|
out.println(line)
|
||||||
|
out.flush()
|
||||||
read()
|
read()
|
||||||
}
|
}
|
||||||
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
|
// just wait a couple seconds to read more stuff if there is
|
||||||
// any stuff.
|
// any stuff.
|
||||||
if (waitForErrors) {
|
if (waitForErrors) {
|
||||||
endTime.set(System.currentTimeMillis + 2000)
|
endTime.set(System.currentTimeMillis + 5000)
|
||||||
// at this point we'd rather the dumper thread run
|
// at this point we'd rather the dumper thread run
|
||||||
// before we check whether to sleep
|
// before we check whether to sleep
|
||||||
Thread.`yield`()
|
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.")
|
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")
|
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)
|
LaunchConfiguration.save(config, launchConfig)
|
||||||
val jvmArgs: List[String] = serverConfig.jvmArgs map readLines match {
|
val jvmArgs: List[String] = serverConfig.jvmArgs map readLines match {
|
||||||
case Some(args) => args
|
case Some(args) => args
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ object Sbt extends Build {
|
||||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||||
incOptions := incOptions.value.withNameHashing(true),
|
incOptions := incOptions.value.withNameHashing(true),
|
||||||
commands += Command.command("setupBuildScala211") { state =>
|
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" ::
|
"set Util.includeTestDependencies in ThisBuild := true" ::
|
||||||
state
|
state
|
||||||
},
|
},
|
||||||
|
|
@ -48,12 +48,12 @@ object Sbt extends Build {
|
||||||
// TODO - To some extent these should take args to figure out what to do.
|
// TODO - To some extent these should take args to figure out what to do.
|
||||||
commands += Command.command("release-libs-211") { state =>
|
commands += Command.command("release-libs-211") { state =>
|
||||||
"setupBuildScala211" ::
|
"setupBuildScala211" ::
|
||||||
/// First test
|
/// First test
|
||||||
lameAgregateTask("test") ::
|
lameAgregateTask("test") ::
|
||||||
// Note: You need the sbt-pgp plugin installed to release.
|
// Note: You need the sbt-pgp plugin installed to release.
|
||||||
lameAgregateTask("publishSigned") ::
|
lameAgregateTask("publishSigned") ::
|
||||||
// Now restore the defaults.
|
// Now restore the defaults.
|
||||||
"reload" :: state
|
"reload" :: state
|
||||||
},
|
},
|
||||||
commands += Command.command("release-sbt-local") { state =>
|
commands += Command.command("release-sbt-local") { state =>
|
||||||
"publishLocal" ::
|
"publishLocal" ::
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.io.File
|
||||||
import java.net.URLClassLoader
|
import java.net.URLClassLoader
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
|
|
||||||
|
// Hack for testing only
|
||||||
private[sbt] final class ClassLoaderCache(val commonParent: ClassLoader) {
|
private[sbt] final class ClassLoaderCache(val commonParent: ClassLoader) {
|
||||||
private[this] val delegate = new HashMap[List[File], Reference[CachedClassLoader]]
|
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)
|
get(files, stamps, existingRef.get)
|
||||||
|
|
||||||
private[this] def get(files: List[File], stamps: List[Long], existing: CachedClassLoader): ClassLoader =
|
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)
|
newEntry(files, stamps)
|
||||||
else
|
} else
|
||||||
existing.loader
|
existing.loader
|
||||||
|
|
||||||
private[this] def newEntry(files: List[File], stamps: List[Long]): ClassLoader =
|
private[this] def newEntry(files: List[File], stamps: List[Long]): ClassLoader =
|
||||||
|
|
|
||||||
|
|
@ -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 }
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue