Skip to content

Commit be3e84b

Browse files
committed
Add dotty runner script able to run dotty-compiled class with main
1 parent 1f4c9f4 commit be3e84b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

bin/dotty

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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\" && 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 "usage: $0 MainClass args"
20+
echo ""
21+
echo " missing class argument"
22+
exit 1
23+
else
24+
runMain "$@"
25+
fi

0 commit comments

Comments
 (0)