aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2016-05-27 11:01:09 +0200
committerDmitry Petrashko <dark@d-d.me>2016-05-27 11:01:09 +0200
commit079192ea78e53084bbe91460a2941ddb46bcbc20 (patch)
treee449119ca9b7d2dd70a9e4c8a2e54c00ccc2f54c
parent3ee785afadbc57f53ccb9cb0d8a98d0eb395dde2 (diff)
parent3c638451ba9842e33c5e0b83433ca406c64a3bb4 (diff)
downloaddotty-079192ea78e53084bbe91460a2941ddb46bcbc20.tar.gz
dotty-079192ea78e53084bbe91460a2941ddb46bcbc20.tar.bz2
dotty-079192ea78e53084bbe91460a2941ddb46bcbc20.zip
Merge pull request #1250 from felixmulder/topic/dotty-runner
Add dotty runner script able to run dotty-compiled class with `main`
-rwxr-xr-xbin/dotc6
-rwxr-xr-xbin/dotr23
2 files changed, 26 insertions, 3 deletions
diff --git a/bin/dotc b/bin/dotc
index c52abc3d4..7f98f017b 100755
--- a/bin/dotc
+++ b/bin/dotc
@@ -3,12 +3,12 @@
# it's based on miniboxing script and paulp's launcher script
# Try to autodetect real location of the script
-DOTTY_ROOT="`readlink \"$0\"`" # relative, symbolic links resolved
+DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved
if [[ "$DOTTY_ROOT" == "" ]]; then
DOTTY_ROOT="$0"
fi
-DOTTY_ROOT="`dirname \"$DOTTY_ROOT\"`"
-DOTTY_ROOT="`( cd \"$DOTTY_ROOT\" >& /dev/null && pwd )`/.." # absolute
+DOTTY_ROOT="$(dirname "$DOTTY_ROOT")"
+DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
# Finds in dotty build file a line containing PATTERN
# returns last "" escaped string in this line
diff --git a/bin/dotr b/bin/dotr
new file mode 100755
index 000000000..ee113b706
--- /dev/null
+++ b/bin/dotr
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Try to autodetect real location of the script
+DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved
+if [[ "$DOTTY_ROOT" == "" ]]; then
+ DOTTY_ROOT="$0"
+fi
+DOTTY_ROOT="$(dirname "$DOTTY_ROOT")"
+DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
+
+# CLASS_PATH is derived from the DOTTY_ROOT
+CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/"
+
+function runMain {
+ scala $CLASS_PATH $@
+}
+
+if [ -z "$1" ]; then
+ echo "Starting dotty REPL..."
+ eval "$DOTTY_ROOT/bin/dotc -repl"
+else
+ runMain "$@"
+fi