2
2
# This script is used for running compiler standalone(outside of sbt)
3
3
# it's based on miniboxing script and paulp's launcher script
4
4
5
+ # Try to autodetect real location of the script
6
+ DOTTY_ROOT=" ` readlink \" $0 \" ` " # relative, symbolic links resolved
7
+ if [[ " $DOTTY_ROOT " == " " ]]; then
8
+ DOTTY_ROOT=" $0 "
9
+ fi
10
+ DOTTY_ROOT=" ` dirname \" $DOTTY_ROOT \" ` "
11
+ DOTTY_ROOT=" ` ( cd \" $DOTTY_ROOT \" && pwd )` /.." # absolute
12
+
13
+ # Finds in dotty build file a line containing PATTERN
14
+ # returns last "" escaped string in this line
15
+ function getLastStringOnLineWith {
16
+ PATTERN=" $1 "
17
+ grep " $PATTERN " " $DOTTY_ROOT /project/Build.scala" | sed -n ' s/.*\"\(.*\)\".*/\1/' p
18
+ }
5
19
6
20
# Configuration
7
- SCALA_VERSION=2.11.5
21
+ SCALA_VERSION=$( getLastStringOnLineWith " scalaVersion in " )
8
22
SCALA_BINARY_VERSION=2.11
9
- SCALA_COMPILER_VERSION=2.11.5-20150416-144435-09c4a520e1
10
- DOTTY_VERSION=0.1
11
- JLINE_VERSION=2.12
23
+ SCALA_COMPILER_VERSION=$( getLastStringOnLineWith " scala-compiler " )
24
+ DOTTY_VERSION=$( getLastStringOnLineWith " version in " )
25
+ JLINE_VERSION=$( getLastStringOnLineWith " jline " )
12
26
bootcp=true
13
27
default_java_opts=" -Xmx768m -Xms768m"
14
28
programName=$( basename " $0 " )
@@ -25,16 +39,10 @@ CompilerMain=dotty.tools.dotc.Main
25
39
ReplMain=test.DottyRepl
26
40
27
41
28
- # Try to autodetect real location of the script
29
- DOTTY_ROOT=" ` readlink \" $0 \" ` " # relative, symbolic links resolved
30
- if [[ " $DOTTY_ROOT " == " " ]]; then
31
- DOTTY_ROOT=" $0 "
32
- fi
33
- DOTTY_ROOT=" ` dirname \" $DOTTY_ROOT \" ` "
34
- DOTTY_ROOT=" ` ( cd \" $DOTTY_ROOT \" && pwd )` /.." # absolute
42
+
35
43
# autodetecting the compiler jar. this is location where sbt 'packages' it
36
- MAIN_JAR=$DOTTY_ROOT /target/scala-$SCALA_BINARY_VERSION /dotty_$SCALA_BINARY_VERSION -$DOTTY_VERSION -SNAPSHOT .jar
37
- TEST_JAR=$DOTTY_ROOT /target/scala-$SCALA_BINARY_VERSION /dotty_$SCALA_BINARY_VERSION -$DOTTY_VERSION -SNAPSHOT- tests.jar
44
+ MAIN_JAR=$DOTTY_ROOT /target/scala-$SCALA_BINARY_VERSION /dotty_$SCALA_BINARY_VERSION -$DOTTY_VERSION .jar
45
+ TEST_JAR=$DOTTY_ROOT /target/scala-$SCALA_BINARY_VERSION /dotty_$SCALA_BINARY_VERSION -$DOTTY_VERSION -tests.jar
38
46
function checkjar {
39
47
if [ ! -f " $1 " ]
40
48
then
0 commit comments