diff options
author | Paul Phillips <paulp@improving.org> | 2011-11-13 01:56:10 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-11-13 01:56:10 +0000 |
commit | b6a300f3ac965285583ed39348ad43abb6df019e (patch) | |
tree | 9e919340b1ab94d9b849ca1d49b7437924404bf1 /src/compiler/scala/tools/nsc/interpreter/ILoop.scala | |
parent | ea5aac152dab47e7e4aa37224a0b8a609b6d9a0c (diff) | |
download | scala-b6a300f3ac965285583ed39348ad43abb6df019e.tar.gz scala-b6a300f3ac965285583ed39348ad43abb6df019e.tar.bz2 scala-b6a300f3ac965285583ed39348ad43abb6df019e.zip |
Working on the runners.
Removed assumption that bash is in /bin. Removed --posix option to bash.
Modernized shell constructs: $() instead of ``, [[ ]] instead of [ ].
Added -debug option for all runners which will show you the exact java
command line being run before running it. Added -usebootcp to complement
-nobootcp, and made regular classpath the default on cygwin. Quoted more
things to give us a fighting chance against spaces and parens in paths.
I took the waste-half-a-day step of installing vmware fusion so I could
install windows so I could install cygwin so I could install scala
under cygwin so I could see if it still worked. Seems to. We still
desperately need some way of testing not only everything I'm attempting
to address in this pile of patches but everything which is most likely
now regressing.
:javap now sort of works on windows (not for repl-defined classes as
yet) if JAVA_HOME is set such that I can find tools.jar. Closes SI-4959.
(Risks breaking and) references SI-2092. References SI-622 since that
shouldn't be hard to get working.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/ILoop.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/ILoop.scala | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index ce74b2a8c3..391d5ab8ee 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -17,9 +17,10 @@ import scala.collection.mutable.ListBuffer import scala.concurrent.ops import util.{ ClassPath, Exceptional, stringFromWriter, stringFromStream } import interpreter._ -import io.{ File, Sources } +import io.{ File, Sources, Directory } import scala.reflect.NameTransformer._ -import util.ScalaClassLoader._ +import util.ScalaClassLoader +import ScalaClassLoader._ import scala.tools.util._ /** The Scala interactive shell. It provides a read-eval-print loop @@ -374,7 +375,17 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } } - protected def newJavap() = new JavapClass(intp.classLoader, new IMain.ReplStrippingWriter(intp)) { + private def addToolsJarToLoader() = { + val javaHome = Directory(sys.env("JAVA_HOME")) + val tools = javaHome / "lib" / "tools.jar" + if (tools.isFile) { + echo("Found tools.jar, adding for use by javap.") + ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader) + } + else intp.classLoader + } + + protected def newJavap() = new JavapClass(addToolsJarToLoader(), new IMain.ReplStrippingWriter(intp)) { override def tryClass(path: String): Array[Byte] = { val hd :: rest = path split '.' toList; // If there are dots in the name, the first segment is the |