aboutsummaryrefslogtreecommitdiff
path: root/bin/dottyr
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dottyr')
-rwxr-xr-xbin/dottyr23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/dottyr b/bin/dottyr
new file mode 100755
index 000000000..cac1114b2
--- /dev/null
+++ b/bin/dottyr
@@ -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" && 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