aboutsummaryrefslogtreecommitdiff
path: root/bin/dotr
blob: ee113b7060fc84e7016e00aabebcdb63d820c7e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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