Skip to content

Commit

Permalink
Unfork jline: use vanilla jline 2.11 as a dependency.
Browse files Browse the repository at this point in the history
Notes:
  - no longer specifying terminal by class name in scripts (using 'unix')
  - jline doesn't need a separate jansi dependency;
    it includes its own version according to:
    http://mvnrepository.com/artifact/jline/jline/2.11
  • Loading branch information
adriaanm committed Jul 5, 2013
1 parent 46a4635 commit 1b0fa91
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 109 deletions.
39 changes: 24 additions & 15 deletions build.xml
Expand Up @@ -123,7 +123,6 @@ TODO:
<property name="library.starr.jar" value="${lib.dir}/scala-library.jar"/>
<property name="reflect.starr.jar" value="${lib.dir}/scala-reflect.jar"/>
<property name="compiler.starr.jar" value="${lib.dir}/scala-compiler.jar"/>
<property name="jline.jar" value="${lib.dir}/jline.jar"/>
<property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
<property name="scalacheck.jar" value="${lib.dir}/scalacheck.jar"/>

Expand Down Expand Up @@ -153,6 +152,8 @@ TODO:
<property name="copyright.string" value="Copyright 2002-2013, LAMP/EPFL"/>
<property name="partest.version.number" value="0.9.3"/>

<property name="jline.version" value="2.11"/>

<!-- These are NOT the flags used to run SuperSabbus, but the ones written
into the script runners created with scala.tools.ant.ScalaTool -->
<property name="java.flags" value="-Xmx256M -Xms32M"/>
Expand Down Expand Up @@ -238,6 +239,10 @@ TODO:
<dependency groupId="org.scala-tools.testing" artifactId="test-interface" version="0.5" />
</artifact:dependencies>

<artifact:dependencies pathId="repl.deps.classpath" filesetId="repl.deps.fileset" versionsId="repl.deps.versions">
<dependency groupId="jline" artifactId="jline" version="${jline.version}"/>
</artifact:dependencies>

<!-- BND support -->
<typedef resource="aQute/bnd/ant/taskdef.properties" classpathref="extra.tasks.classpath" />

Expand Down Expand Up @@ -529,7 +534,7 @@ TODO:
<path id="quick.repl.build.path">
<path refid="quick.compiler.build.path"/>
<pathelement location="${build-quick.dir}/classes/repl"/>
<pathelement location="${jline.jar}"/>
<path refid="repl.deps.classpath"/>
</path>

<path id="quick.xml.build.path">
Expand Down Expand Up @@ -610,7 +615,7 @@ TODO:
<pathelement location="${build-pack.dir}/lib/scala-reflect.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
<pathelement location="${build-pack.dir}/lib/scalap.jar"/>
<pathelement location="${build-pack.dir}/lib/jline.jar"/>
<path refid="repl.deps.classpath"/>
<path refid="aux.libs"/>
</path>

Expand Down Expand Up @@ -740,7 +745,7 @@ TODO:
<pathelement location="${build-palo.dir}/lib/scala-library.jar"/>
<pathelement location="${build-palo.dir}/lib/scala-reflect.jar"/>
<pathelement location="${build-palo.dir}/lib/scala-compiler.jar"/>
<pathelement location="${build-palo.dir}/lib/jline.jar"/>
<path refid="repl.deps.classpath"/>
</path>

<path id="test.positions.sub.build.path" path="${build-quick.dir}/classes/library"/>
Expand Down Expand Up @@ -1265,7 +1270,10 @@ TODO:
<target name="pack.comp" depends="quick.comp, quick.scaladoc, quick.interactive, quick.repl, asm.done">
<staged-pack project="compiler" manifest="${build-pack.dir}/META-INF/MANIFEST.MF">
<pre> <!-- TODO the files copied here do not influence actuality of this target (nor does the manifest) -->
<copy file="${jline.jar}" toDir="${build-pack.dir}/lib"/>
<copy todir="${build-pack.dir}/lib">
<resources refid="repl.deps.fileset"/>
<mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper" from="${repl.deps.versions}" to="flatten"/>
</copy>
<copy todir="${build-pack.dir}/lib">
<fileset dir="${lib-extra.dir}">
<include name="**/*.jar"/>
Expand Down Expand Up @@ -1340,7 +1348,10 @@ TODO:
<fileset dir="${build-locker.dir}/classes/compiler"/>
<fileset dir="${asm-classes}"/>
</jar>
<copy file="${jline.jar}" toDir="${build-palo.dir}/lib"/>
<copy todir="${build-palo.dir}/lib">
<resources refid="repl.deps.fileset"/>
<mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper" from="${repl.deps.versions}" to="flatten"/>
</copy>
</target>

<target name="palo.bin" depends="palo.done"> <staged-bin stage="palo"/></target>
Expand Down Expand Up @@ -1738,13 +1749,6 @@ TODO:
</staged-docs>
</target>

<target name="docs.jline" depends="docs.start">
<staged-docs project="jline" dir="jline/src/main/java" title="Scala JLine">
<include name="**/*.scala"/>
<include name="**/*.java"/>
</staged-docs>
</target>

<target name="docs.scalap" depends="docs.start">
<staged-docs project="scalap" title="Scalap">
<include name="**/*.scala"/>
Expand Down Expand Up @@ -1800,7 +1804,7 @@ TODO:
</staged-uptodate>
</target>

<target name="docs.done" depends="docs.jline, docs.comp, docs.man, docs.lib, docs.xml, docs.parser-combinators, docs.scalap, docs.partest, docs.continuations-plugin"/>
<target name="docs.done" depends="docs.comp, docs.man, docs.lib, docs.xml, docs.parser-combinators, docs.scalap, docs.partest, docs.continuations-plugin"/>

<!-- ===========================================================================
DISTRIBUTION
Expand Down Expand Up @@ -1828,7 +1832,6 @@ TODO:
<mkdir dir="${dist.dir}/lib"/>
<copy toDir="${dist.dir}/lib">
<fileset dir="${build-pack.dir}/lib">
<include name="jline.jar"/>
<include name="scalacheck.jar"/>
<include name="scala-partest.jar"/>
<include name="scalap.jar"/>
Expand All @@ -1841,6 +1844,12 @@ TODO:
from="${partest.extras.versions}" to="flatten"/>
</copy>

<copy todir="${dist.dir}/lib">
<resources refid="repl.deps.fileset"/>
<mapper classpathref="maven-ant-tasks.classpath" classname="org.apache.maven.artifact.ant.VersionMapper"
from="${repl.deps.versions}" to="flatten"/>
</copy>

<mkdir dir="${dist.dir}/bin"/>
<!-- TODO - Stop being inefficient and don't copy OSGi bundles overtop other jars. -->
<copy-bundle name="scala-library"/>
Expand Down
1 change: 0 additions & 1 deletion lib/jline.jar.desired.sha1

This file was deleted.

2 changes: 1 addition & 1 deletion src/build/bnd/scala-compiler.bnd
Expand Up @@ -3,6 +3,6 @@ Bundle-SymbolicName: org.scala-lang.scala-compiler
ver: @VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.tools.jline.*;resolution:=optional, \
Import-Package: jline.*;resolution:=optional, \
org.apache.tools.ant.*;resolution:=optional, \
*
68 changes: 0 additions & 68 deletions src/build/maven/jline-pom.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/build/maven/maven-deploy.xml
Expand Up @@ -57,6 +57,7 @@
<filter token="VERSION" value="@{version}" />
<filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" />
<filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" />
<filter token="JLINE_VERSION" value="${jline.version}" />
</filterset>
</copy>
<artifact:pom id="@{name}.pom" file="${path}-pom-filtered.xml" />
Expand Down Expand Up @@ -104,7 +105,6 @@
<attribute name="signed" default="false"/>

<sequential>
<deploy-one name="jline" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-actors" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-compiler" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
<deploy-one name="scala-library" version="${maven.version.number}" local="@{local}" signed="@{signed}"/>
Expand Down
4 changes: 2 additions & 2 deletions src/build/maven/scala-compiler-pom.xml
Expand Up @@ -43,9 +43,9 @@
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>@VERSION@</version>
<version>@JLINE_VERSION@</version>
<optional>true</optional>
</dependency>
</dependencies>
Expand Down
11 changes: 0 additions & 11 deletions src/build/pack.xml
Expand Up @@ -151,7 +151,6 @@ MAIN DISTRIBUTION PACKAGING
</copy>
</sequential>
</macrodef>
<mvn-copy-lib mvn.artifact.name="jline"/>
<mvn-copy-lib mvn.artifact.name="scala-library"/>
<mvn-copy-lib mvn.artifact.name="scala-xml"/>
<mvn-copy-lib mvn.artifact.name="scala-parser-combinators"/>
Expand Down Expand Up @@ -183,12 +182,6 @@ MAIN DISTRIBUTION PACKAGING

<target name="pack-maven.srcs" depends="pack-maven.libs">
<!-- Add missing src jars. -->
<jar whenmanifestonly="fail" destfile="${dists.dir}/maven/${version.number}/jline/jline-src.jar"
basedir="${src.dir}/jline/src/main/java">
<include name="**/*"/>
</jar>


<!-- Continuations plugin -->
<jar whenmanifestonly="fail" destfile="${dists.dir}/maven/${version.number}/plugins/continuations/continuations-src.jar"
basedir="${src.dir}/continuations/plugin">
Expand All @@ -197,10 +190,6 @@ MAIN DISTRIBUTION PACKAGING
</target>

<target name="pack-maven.docs" depends="pack-maven.libs, pack-maven.plugins">
<jar whenmanifestonly="fail" destfile="${dists.dir}/maven/${version.number}/jline/jline-docs.jar"
basedir="${build-docs.dir}/jline">
<include name="**/*"/>
</jar>
<jar whenmanifestonly="fail" destfile="${dists.dir}/maven/${version.number}/scala-library/scala-library-docs.jar"
basedir="${build-docs.dir}/library">
<include name="**/*"/>
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/ant/templates/tool-unix.tmpl
Expand Up @@ -115,7 +115,7 @@ if [[ -n "$cygwin$mingw" ]]; then
case "$TERM" in
rxvt* | xterm*)
stty -icanon min 1 -echo
WINDOWS_OPT="-Djline.terminal=scala.tools.jline.UnixTerminal"
WINDOWS_OPT="-Djline.terminal=unix"
;;
esac
fi
Expand Down
Expand Up @@ -6,7 +6,7 @@
package scala.tools.nsc
package interpreter

import scala.tools.jline.console.{ ConsoleReader, CursorBuffer }
import jline.console.{ ConsoleReader, CursorBuffer }

trait ConsoleReaderHelper extends ConsoleReader {
def terminal = getTerminal()
Expand Down
2 changes: 1 addition & 1 deletion src/repl/scala/tools/nsc/interpreter/Delimited.scala
Expand Up @@ -6,7 +6,7 @@
package scala.tools.nsc
package interpreter

import scala.tools.jline.console.completer.ArgumentCompleter.{ ArgumentDelimiter, ArgumentList }
import jline.console.completer.ArgumentCompleter.{ ArgumentDelimiter, ArgumentList }

class JLineDelimiter extends ArgumentDelimiter {
def toJLine(args: List[String], cursor: Int) = args match {
Expand Down
6 changes: 3 additions & 3 deletions src/repl/scala/tools/nsc/interpreter/JLineReader.scala
Expand Up @@ -6,8 +6,8 @@
package scala.tools.nsc
package interpreter

import scala.tools.jline.console.ConsoleReader
import scala.tools.jline.console.completer._
import jline.console.ConsoleReader
import jline.console.completer._
import session._
import Completion._

Expand Down Expand Up @@ -42,7 +42,7 @@ class JLineReader(_completion: => Completion) extends InteractiveReader {
def readOneKey(prompt: String) = {
this.print(prompt)
this.flush()
this.readVirtualKey()
this.readCharacter()
}
def eraseLine() = consoleReader.resetPromptLine("", "", 0)
def redrawLineAndFlush(): Unit = { flush() ; drawLine() ; flush() }
Expand Down
Expand Up @@ -46,6 +46,11 @@ class SimpleHistory extends JLineHistory {
def entries(): JListIterator[JEntry] = toEntries().asJava.listIterator()
def iterator: JIterator[JEntry] = toEntries().iterator.asJava

def remove(idx: Int): CharSequence = buf remove idx
def removeFirst(): CharSequence = buf remove 0
def removeLast(): CharSequence = buf remove lastIndex
def set(idx: Int, to: CharSequence): Unit = buf(idx) = to

def current() = if (index >= 0 && index < buf.size) buf(index) else fail("current()")
def previous() = (index > 0) && minusOne
def next() = (index <= lastIndex) && plusOne
Expand Down
8 changes: 4 additions & 4 deletions src/repl/scala/tools/nsc/interpreter/session/package.scala
Expand Up @@ -14,10 +14,10 @@ package object session {
type JIterator[T] = java.util.Iterator[T]
type JListIterator[T] = java.util.ListIterator[T]

type JEntry = scala.tools.jline.console.history.History.Entry
type JHistory = scala.tools.jline.console.history.History
type JMemoryHistory = scala.tools.jline.console.history.MemoryHistory
type JPersistentHistory = scala.tools.jline.console.history.PersistentHistory
type JEntry = jline.console.history.History.Entry
type JHistory = jline.console.history.History
type JMemoryHistory = jline.console.history.MemoryHistory
type JPersistentHistory = jline.console.history.PersistentHistory

private[interpreter] implicit def charSequenceFix(x: CharSequence): String = x.toString
}

0 comments on commit 1b0fa91

Please sign in to comment.