File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,40 @@ if [[ "$DOTTY_ROOT" == "" ]]; then
7
7
fi
8
8
DOTTY_ROOT=" $( dirname " $DOTTY_ROOT " ) "
9
9
DOTTY_ROOT=" $( cd " $DOTTY_ROOT " >& /dev/null && pwd ) /.." # absolute
10
+ SCALA_VERSION=$( grep " scalaVersion in" " $DOTTY_ROOT /project/Build.scala" | sed -n ' s/.*\"\(.*\)\".*/\1/' p)
10
11
11
- # CLASS_PATH is derived from the DOTTY_ROOT
12
- CLASS_PATH=" -J-Xbootclasspath/a:.:$DOTTY_ROOT /target/scala-2.11/classes/"
12
+ function find_jar {
13
+ # Usage:
14
+ # find_jar path/to/location file.jar
15
+ local artifact=" $1 /$2 "
16
+
17
+ if [ ! -f " $artifact " ]; then
18
+ artifact=$( find " $HOME /.coursier/cache" -iname " $2 " )
19
+ fi
20
+
21
+ echo " $artifact "
22
+ }
23
+
24
+ # Autodetecting the scala-library location, in case it wasn't provided by an environment variable
25
+ if [ " $SCALA_LIBRARY_JAR " == " " ]; then
26
+ SCALA_LIBRARY_JAR=$( find_jar " $HOME /.ivy2/cache/org.scala-lang/scala-library/jars" " scala-library-$SCALA_VERSION .jar" )
27
+ fi
28
+
29
+ # CLASS_PATH is derived from the DOTTY_ROOT and SCALA_LIBRARY_JAR
30
+ CLASS_PATH=" -Xbootclasspath/a:.:$DOTTY_ROOT /target/scala-2.11/classes/:.:$SCALA_LIBRARY_JAR "
13
31
14
32
function runMain {
15
- scala $CLASS_PATH $@
33
+ local jbin=$( which " java" )
34
+
35
+ if [ ! -z " $JAVA_BIN " ]; then
36
+ jbin=$JAVA_BIN
37
+ fi
38
+
39
+ if [ " $jbin " == " " ]; then
40
+ echo " java bin not detected - please specify with \$ JAVA_BIN or install java to a default location"
41
+ else
42
+ eval " $jbin $CLASS_PATH $@ "
43
+ fi
16
44
}
17
45
18
46
if [ -z " $1 " ]; then
You can’t perform that action at this time.
0 commit comments