diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-14 14:49:08 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-02-17 14:01:30 +0100 |
commit | 778072d5bd7763d7c5181e405db84e341be27ca3 (patch) | |
tree | 56b67b211b2c302ee8ae77343ebd70053675c908 /bin/dotc | |
parent | 2e72811fb1cedb94c7967acf96c92172f010a20b (diff) | |
download | dotty-778072d5bd7763d7c5181e405db84e341be27ca3.tar.gz dotty-778072d5bd7763d7c5181e405db84e341be27ca3.tar.bz2 dotty-778072d5bd7763d7c5181e405db84e341be27ca3.zip |
Add dotty repl & type stealer
Dotty requires a mangled bootclasspath to start.
It means that `console` mode of sbt doesn't work for us.
At least I wasn't able to make sbt fork in console,
so instead I've added a Scala-repl into dotty itself :-)
It would be good to make it use dotty one day when we have
a backend :-)
Diffstat (limited to 'bin/dotc')
-rwxr-xr-x | bin/dotc | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -4,10 +4,11 @@ # Configuration -SCALA_VERSION=2.11.4 +SCALA_VERSION=2.11.5 SCALA_BINARY_VERSION=2.11 SCALA_COMPILER_VERSION=2.11.5-20141212-151631-beaa78b033 DOTTY_VERSION=0.1 +JLINE_VERSION=2.12 bootcp=true default_java_opts="-Xmx768m -Xms768m" programName=$(basename "$0") @@ -21,6 +22,7 @@ unset verbose quiet cygwin toolcp colors saved_stty CDPATH CompilerMain=dotty.tools.dotc.Main +ReplMain=test.DottyRepl # Try to autodetect real location of the script @@ -32,7 +34,7 @@ DOTTY_ROOT="`dirname \"$DOTTY_ROOT\"`" DOTTY_ROOT="`( cd \"$DOTTY_ROOT\" && pwd )`/.." # absolute # autodetecting the compiler jar. this is location where sbt 'packages' it MAIN_JAR=$DOTTY_ROOT/target/scala-$SCALA_BINARY_VERSION/dotty_$SCALA_BINARY_VERSION-$DOTTY_VERSION-SNAPSHOT.jar - +TEST_JAR=$DOTTY_ROOT/target/scala-$SCALA_BINARY_VERSION/dotty_$SCALA_BINARY_VERSION-$DOTTY_VERSION-SNAPSHOT-tests.jar function checkjar { if [ ! -f "$1" ] then @@ -51,6 +53,7 @@ function checkjar { } checkjar $MAIN_JAR package +checkjar $TEST_JAR test:package # Autodetecting the scala-library location, in case it wasn't provided by an environment variable if [ "$SCALA_LIBRARY_JAR" == "" ] @@ -68,13 +71,18 @@ then SCALA_COMPILER_JAR=$HOME/.ivy2/cache/me.d-d/scala-compiler/jars/scala-compiler-$SCALA_COMPILER_VERSION.jar fi -if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" -o ! -f "$SCALA_COMPILER_JAR" ] +if [ "$JLINE_JAR" == "" ] +then + JLINE_JAR=$HOME/.ivy2//cache/jline/jline/jars/jline-$JLINE_VERSION.jar +fi + +if [ ! -f "$SCALA_LIBRARY_JAR" -o ! -f "$SCALA_REFLECT_JAR" -o ! -f "$SCALA_COMPILER_JAR" -o ! -f "$JLINE_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)" fi ifdebug () { @@ -163,9 +171,9 @@ trap onExit INT # to java to suppress "." from materializing. classpathArgs () { if [[ -n $bootcp ]]; then -echo "-Xbootclasspath/a:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$MAIN_JAR -classpath $MAIN_JAR" +echo "-Xbootclasspath/a:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$JLINE_JAR:$MAIN_JAR -classpath $MAIN_JAR:$TEST_JAR" else -echo "-classpath $SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$MAIN_JAR" +echo "-classpath $SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$JLINE_JAR:$MAIN_JAR:$TEST_JAR" fi } @@ -181,8 +189,7 @@ require_arg () { } - - +main_class=$CompilerMain while [[ $# -gt 0 ]]; do case "$1" in @@ -230,7 +237,7 @@ execCommand \ "${java_args[@]}" \ "$(classpathArgs)" \ -Dscala.usejavacp=true \ - "${CompilerMain}" \ + "${main_class}" \ "${scala_args[@]}" \ "${residual_args[@]}" |