Skip to content

Commit

Permalink
Fixes scala#1316: Remove JLine
Browse files Browse the repository at this point in the history
Dotty uses ammonite.terminal since April (53bd25f) which replaces JLine.
There is no reason to keep it anymore.
  • Loading branch information
kzys committed Jul 27, 2016
1 parent 5ffce6e commit 8e55954
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 46 deletions.
5 changes: 0 additions & 5 deletions bin/common
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function getLastStringOnLineWith {
SCALA_VERSION=$(getLastStringOnLineWith "scalaVersion in")
SCALA_BINARY_VERSION=2.11
SCALA_COMPILER_VERSION=$(getLastStringOnLineWith "scala-compiler")
JLINE_VERSION=$(getLastStringOnLineWith "jline")
SBT_VERSION=$(grep "sbt.version=" "$DOTTY_ROOT/project/build.properties" | sed 's/sbt.version=//')
bootcp=true
bootstrapped=false
Expand Down Expand Up @@ -129,10 +128,6 @@ if [ "$SCALA_COMPILER_JAR" == "" ]; then
SCALA_COMPILER_JAR=$(find_jar "$HOME/.ivy2/cache/me.d-d/scala-compiler/jars" "scala-compiler-$SCALA_COMPILER_VERSION.jar")
fi

if [ "$JLINE_JAR" == "" ]; then
JLINE_JAR=$(find_jar "$HOME/.ivy2/cache/jline/jline/jars" "jline-$JLINE_VERSION.jar")
fi

if [ "$SBT_INTERFACE_JAR" == "" ]; then
SBT_INTERFACE_JAR=$(find_jar "$HOME/.ivy2/cache/org.scala-sbt/interface/jars" "interface-$SBT_VERSION.jar")
fi
7 changes: 3 additions & 4 deletions bin/dotc
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ CompilerMain=dotty.tools.dotc.Main
FromTasty=dotty.tools.dotc.FromTasty
ReplMain=dotty.tools.dotc.repl.Main

if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" -o ! -f "$SCALA_COMPILER_JAR" -o ! -f "$JLINE_JAR" -o ! -f "$SBT_INTERFACE_JAR" ]
if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" -o ! -f "$SCALA_COMPILER_JAR" -o ! -f "$SBT_INTERFACE_JAR" ]
then
echo To use this script please set
echo SCALA_LIBRARY_JAR to point to scala-library-$SCALA_VERSION.jar "(currently $SCALA_LIBRARY_JAR)"
echo SCALA_REFLECT_JAR to point to scala-reflect-$SCALA_VERSION.jar "(currently $SCALA_REFLECT_JAR)"
echo SCALA_COMPILER_JAR to point to scala-compiler-$SCALA_VERSION.jar with bcode patches "(currently $SCALA_COMPILER_JAR)"
echo JLINE_JAR to point to jline-$JLINE_VERSION.jar "(currently $JLINE_JAR)"
echo SBT_INTERFACE_JAR to point to interface-$SBT_VERSION.jar "(currently $SBT_INTERFACE_JAR)"
fi

Expand Down Expand Up @@ -116,9 +115,9 @@ trap onExit INT
classpathArgs () {
if [[ "true" == $bootstrapped ]]; then
check_jar "dotty-bootstrapped" $DOTTY_JAR "target" 'build_jar "test:runMain dotc.build" target' &> /dev/null
toolchain="$DOTTY_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$JLINE_JAR:$SBT_INTERFACE_JAR"
toolchain="$DOTTY_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
else
toolchain="$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$JLINE_JAR:$SBT_INTERFACE_JAR"
toolchain="$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
fi
bcpJars="$INTERFACES_JAR:$MAIN_JAR"
cpJars="$INTERFACES_JAR:$MAIN_JAR:$TEST_JAR"
Expand Down
1 change: 0 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ object DottyBuild extends Build {
libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-xml" % "1.0.1",
"org.scala-lang.modules" %% "scala-partest" % "1.0.11" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test",
"jline" % "jline" % "2.12",
"com.googlecode.java-diff-utils" % "diffutils" % "1.3.0",
"com.typesafe.sbt" % "sbt-interface" % sbtVersion.value),
// enable improved incremental compilation algorithm
Expand Down
1 change: 0 additions & 1 deletion src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class ScalaSettings extends Settings.SettingGroup {
val maxClassfileName = IntSetting("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, 72 to 255)
val Xmigration = VersionSetting("-Xmigration", "Warn about constructs whose behavior may have changed since version.")
val Xsource = VersionSetting("-Xsource", "Treat compiler input as Scala source for the specified version.")
val Xnojline = BooleanSetting("-Xnojline", "Do not use JLine for editing.")
val Xverify = BooleanSetting("-Xverify", "Verify generic signatures in generated bytecode (asm backend only.)")
val plugin = MultiStringSetting("-Xplugin", "file", "Load one or more plugins from files.")
val disable = MultiStringSetting("-Xplugin-disable", "plugin", "Disable the given plugin(s).")
Expand Down
13 changes: 2 additions & 11 deletions src/dotty/tools/dotc/repl/InteractiveReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,8 @@ trait InteractiveReader {
/** The current Scala REPL know how to do this flexibly.
*/
object InteractiveReader {
/** Create an interactive reader. Uses JLine if the
* library is available, but otherwise uses a
* SimpleReader. */
/** Create an interactive reader */
def createDefault(in: Interpreter)(implicit ctx: Context): InteractiveReader = {
try {
new AmmoniteReader(in)
} catch { case e =>
//out.println("jline is not available: " + e) //debug
e.printStackTrace()
println("Could not use ammonite, falling back to simple reader")
new SimpleReader()
}
new AmmoniteReader(in)
}
}
16 changes: 0 additions & 16 deletions src/dotty/tools/dotc/repl/JLineReader.scala

This file was deleted.

3 changes: 1 addition & 2 deletions src/dotty/tools/dotc/repl/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package repl
*
* There are a number of TODOs:
*
* - re-enable jline support (urgent, easy, see TODO in InteractiveReader.scala)
* - figure out why we can launch REPL only with `java`, not with `scala`.
* - make a doti command (urgent, easy)
* - create or port REPL tests (urgent, intermediate)
Expand All @@ -26,4 +25,4 @@ package repl
* - integrate with presentation compiler for command completion (not urgent, hard)
*/
/** The main entry point of the REPL */
object Main extends REPL
object Main extends REPL
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/repl/REPL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ object REPL {
def input(in: Interpreter)(implicit ctx: Context): InteractiveReader = {
val emacsShell = System.getProperty("env.emacs", "") != ""
//println("emacsShell="+emacsShell) //debug
if (ctx.settings.Xnojline.value || emacsShell) new SimpleReader()
if (emacsShell) new SimpleReader()
else InteractiveReader.createDefault(in)
}

Expand Down
5 changes: 0 additions & 5 deletions test/test/ShowClassTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ class ShowClassTests extends DottyTest {
showClasses("scala.math.Ordering")
}
@Test
def loadJavaClasses() = {
showPackage("scala.tools.jline", 0)
}
@Test
def loadMoreClasses() = {
showClasses("scala.collection.JavaConversions")
Expand Down

0 comments on commit 8e55954

Please sign in to comment.