Skip to content

Commit 079192e

Browse files
committed
Merge pull request #1250 from felixmulder/topic/dotty-runner
Add dotty runner script able to run dotty-compiled class with `main`
2 parents 3ee785a + 3c63845 commit 079192e

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

bin/dotc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# it's based on miniboxing script and paulp's launcher script
44

55
# Try to autodetect real location of the script
6-
DOTTY_ROOT="`readlink \"$0\"`" # relative, symbolic links resolved
6+
DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved
77
if [[ "$DOTTY_ROOT" == "" ]]; then
88
DOTTY_ROOT="$0"
99
fi
10-
DOTTY_ROOT="`dirname \"$DOTTY_ROOT\"`"
11-
DOTTY_ROOT="`( cd \"$DOTTY_ROOT\" >& /dev/null && pwd )`/.." # absolute
10+
DOTTY_ROOT="$(dirname "$DOTTY_ROOT")"
11+
DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
1212

1313
# Finds in dotty build file a line containing PATTERN
1414
# returns last "" escaped string in this line

bin/dotr

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Try to autodetect real location of the script
4+
DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved
5+
if [[ "$DOTTY_ROOT" == "" ]]; then
6+
DOTTY_ROOT="$0"
7+
fi
8+
DOTTY_ROOT="$(dirname "$DOTTY_ROOT")"
9+
DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
10+
11+
# CLASS_PATH is derived from the DOTTY_ROOT
12+
CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/"
13+
14+
function runMain {
15+
scala $CLASS_PATH $@
16+
}
17+
18+
if [ -z "$1" ]; then
19+
echo "Starting dotty REPL..."
20+
eval "$DOTTY_ROOT/bin/dotc -repl"
21+
else
22+
runMain "$@"
23+
fi

0 commit comments

Comments
 (0)