mirror of https://github.com/sbt/sbt.git
Removing printlns and adding the test, DOH.
This commit is contained in:
parent
d2950da9dd
commit
da1fc33b52
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
lazy val OtherScala = config("other-scala").hide
|
||||||
|
|
||||||
|
configs(OtherScala)
|
||||||
|
|
||||||
|
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.11.1" % OtherScala.name
|
||||||
|
|
||||||
|
managedClasspath in OtherScala := Classpaths.managedJars(OtherScala, classpathTypes.value, update.value)
|
||||||
|
|
||||||
|
// Hack in the scala instance
|
||||||
|
scalaInstance := {
|
||||||
|
val rawJars = (managedClasspath in OtherScala).value.map(_.data)
|
||||||
|
val scalaHome = (target.value / "scala-home")
|
||||||
|
def removeVersion(name: String): String =
|
||||||
|
name.replaceAll("\\-2.11.1", "")
|
||||||
|
for(jar <- rawJars) {
|
||||||
|
val tjar = scalaHome / s"lib/${removeVersion(jar.getName)}"
|
||||||
|
IO.copyFile(jar, tjar)
|
||||||
|
}
|
||||||
|
IO.listFiles(scalaHome).foreach(f => System.err.println(s" * $f}"))
|
||||||
|
ScalaInstance(scalaHome, appConfiguration.value.provider.scalaProvider.launcher)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
|
||||||
|
|
||||||
|
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.3" % "test"
|
||||||
|
|
||||||
|
scalaVersion := "2.11.0"
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package akka.actor
|
||||||
|
|
||||||
|
import org.junit._
|
||||||
|
|
||||||
|
class BadTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
def testCpIssue(): Unit = {
|
||||||
|
// TODO - This is merely the laziest way to run the test. What we want to do:
|
||||||
|
// * Load something from our own classloader that's INSIDE the scala library
|
||||||
|
// * Try to load that same something from the THREAD CONTEXT classloader.
|
||||||
|
// * Ensure we can do both, i.e. the second used to be filtered and broken.
|
||||||
|
val current = Thread.currentThread.getContextClassLoader
|
||||||
|
val mine = this.getClass.getClassLoader
|
||||||
|
val system = ActorSystem()
|
||||||
|
def evilGetThreadExectionContextName =
|
||||||
|
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName
|
||||||
|
val expected = "scala.concurrent.Future$InternalCallbackExecutor$"
|
||||||
|
Assert.assertEquals("Failed to grab appropriate Akka name", expected, evilGetThreadExectionContextName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> test
|
||||||
|
|
@ -59,14 +59,9 @@ final class ClasspathFilter(parent: ClassLoader, root: ClassLoader, classpath: S
|
||||||
val c = super.loadClass(className, resolve)
|
val c = super.loadClass(className, resolve)
|
||||||
if (includeLoader(c.getClassLoader, root) || fromClasspath(c))
|
if (includeLoader(c.getClassLoader, root) || fromClasspath(c))
|
||||||
c
|
c
|
||||||
else {
|
else
|
||||||
System.err.println(s"DEBUGME: Failing to load class $className because it was not in expected parent chain.")
|
|
||||||
System.err.println(s"DEBUGME: Found: ${c.getClassLoader}")
|
|
||||||
System.err.println(s"DEBUGME: Expected: ${root}")
|
|
||||||
System.err.println(s"DEBUGME: onClasspath: ${fromClasspath(c)}")
|
|
||||||
throw new ClassNotFoundException(className)
|
throw new ClassNotFoundException(className)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private[this] def fromClasspath(c: Class[_]): Boolean =
|
private[this] def fromClasspath(c: Class[_]): Boolean =
|
||||||
{
|
{
|
||||||
val codeSource = c.getProtectionDomain.getCodeSource
|
val codeSource = c.getProtectionDomain.getCodeSource
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue