1
1
#! /usr/bin/env bash
2
+
2
3
# This script is used for running compiler standalone(outside of sbt)
3
4
# it's based on miniboxing script and paulp's launcher script
4
5
10
11
DOTTY_ROOT=" $( dirname " $DOTTY_ROOT " ) "
11
12
DOTTY_ROOT=" $( cd " $DOTTY_ROOT " >& /dev/null && pwd ) /.." # absolute
12
13
13
- source $DOTTY_ROOT /bin/common
14
+ source " $DOTTY_ROOT /bin/common"
14
15
15
16
# dotc.build test places bootstrapped jar here
16
- DOTTY_JAR=$DOTTY_ROOT /dotty.jar
17
+ DOTTY_JAR=" $DOTTY_ROOT /dotty.jar"
17
18
18
19
CompilerMain=dotty.tools.dotc.Main
19
20
FromTasty=dotty.tools.dotc.FromTasty
29
30
fi
30
31
31
32
ifdebug () {
32
- [[ -n $debug ]] && eval " $@ "
33
+ [[ -n " $debug " ]] && eval " $@ "
33
34
}
34
35
echoErr () {
35
36
echo >&2 " $@ "
36
37
}
37
38
dlog () {
38
- [[ -n $debug ]] && echoErr " $@ "
39
+ [[ -n " $debug " ]] && echoErr " $@ "
39
40
}
40
41
41
42
die () {
@@ -52,7 +53,7 @@ echoErr ""
52
53
execCommand () {
53
54
ifdebug echoArgs " $@ "
54
55
ignore=" $( cat " $HOME /.scala_ignore_crashes" 2> /dev/null) "
55
- if [[ $ignore == " true" ]]; then
56
+ if [[ " $ignore " == " true" ]]; then
56
57
" $@ " 2>&1 | scala-crash-filter
57
58
else
58
59
$@
@@ -62,11 +63,11 @@ execCommand () {
62
63
# restore stty settings (echo in particular)
63
64
restoreSttySettings () {
64
65
dlog " " && dlog " [restore stty] $saved_stty "
65
- stty $saved_stty && saved_stty=" "
66
+ stty " $saved_stty " && saved_stty=" "
66
67
}
67
68
68
69
onExit () {
69
- [[ -n $saved_stty ]] && restoreSttySettings
70
+ [[ -n " $saved_stty " ]] && restoreSttySettings
70
71
exit $scala_exit_status
71
72
}
72
73
@@ -103,7 +104,7 @@ addResidual () {
103
104
}
104
105
105
106
onExit () {
106
- [[ -n $saved_stty ]] && restoreSttySettings
107
+ [[ -n " $saved_stty " ]] && restoreSttySettings
107
108
exit $scala_exit_status
108
109
}
109
110
@@ -113,8 +114,8 @@ trap onExit INT
113
114
# If using the boot classpath, also pass an empty classpath
114
115
# to java to suppress "." from materializing.
115
116
classpathArgs () {
116
- if [[ " true" == $bootstrapped ]]; then
117
- check_jar " dotty-bootstrapped" $DOTTY_JAR " target" ' build_jar "test:runMain dotc.build" target' & > /dev/null
117
+ if [[ " true" == " $bootstrapped " ]]; then
118
+ check_jar " dotty-bootstrapped" " $DOTTY_JAR " " target" ' build_jar "test:runMain dotc.build" target' & > /dev/null
118
119
toolchain=" $DOTTY_JAR :$DOTTY_LIB_JAR :$SCALA_LIBRARY_JAR :$SCALA_REFLECT_JAR :$SCALA_COMPILER_JAR :$SBT_INTERFACE_JAR "
119
120
else
120
121
toolchain=" $SCALA_LIBRARY_JAR :$DOTTY_LIB_JAR :$SCALA_REFLECT_JAR :$SCALA_COMPILER_JAR :$SBT_INTERFACE_JAR "
@@ -129,7 +130,7 @@ classpathArgs () {
129
130
format=windows
130
131
fi
131
132
132
- if [[ -n $bootcp ]]; then
133
+ if [[ -n " $bootcp " ]]; then
133
134
boot_classpath=" $( cygpath --path --$format " $toolchain :$bcpJars " ) "
134
135
classpath=" $( cygpath --path --$format " $cpJars " ) "
135
136
cpArgs=" -Xbootclasspath/a:$boot_classpath -classpath $classpath "
@@ -138,7 +139,7 @@ classpathArgs () {
138
139
cpArgs=" -classpath $classpath "
139
140
fi
140
141
else
141
- if [[ -n $bootcp ]]; then
142
+ if [[ -n " $bootcp " ]]; then
142
143
cpArgs=" -Xbootclasspath/a:$toolchain :$bcpJars -classpath $cpJars "
143
144
else
144
145
cpArgs=" -classpath $toolchain :$cpJars "
@@ -159,7 +160,7 @@ require_arg () {
159
160
}
160
161
161
162
162
- main_class=$CompilerMain
163
+ main_class=" $CompilerMain "
163
164
164
165
while [[ $# -gt 0 ]]; do
165
166
case " $1 " in
@@ -172,11 +173,11 @@ case "$1" in
172
173
173
174
# Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
174
175
-Oshort) addJava " -XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;;
175
- -repl) main_class=$ReplMain && shift ;;
176
- -tasty) main_class=$FromTasty && shift ;;
177
- -compile) main_class=$CompilerMain && shift ;;
178
- -run) main_class=$ReplMain && shift ;;
179
- -fsc) main_class=$FscMain && shift ;;
176
+ -repl) main_class=" $ReplMain " && shift ;;
177
+ -tasty) main_class=" $FromTasty " && shift ;;
178
+ -compile) main_class=" $CompilerMain " && shift ;;
179
+ -run) main_class=" $ReplMain " && shift ;;
180
+ -fsc) main_class=" $FscMain " && shift ;;
180
181
-bootcp) bootcp=true && shift ;;
181
182
-nobootcp) unset bootcp && shift ;;
182
183
-colors) colors=true && shift ;;
0 commit comments