aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorOlivier Blanvillain <olivier.blanvillain@gmail.com>2017-02-10 14:37:22 +0100
committerOlivier Blanvillain <olivier.blanvillain@gmail.com>2017-02-10 14:37:22 +0100
commitc568fbda0659e74daa4394c4f92071ec52a06b58 (patch)
treecde02450d685f021cf853dfc9b5e5b573d1908e1 /bin
parent1f97c77861d7309e0aeb734fc66d049988d57bec (diff)
downloaddotty-c568fbda0659e74daa4394c4f92071ec52a06b58.tar.gz
dotty-c568fbda0659e74daa4394c4f92071ec52a06b58.tar.bz2
dotty-c568fbda0659e74daa4394c4f92071ec52a06b58.zip
Quote every string in script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common28
-rwxr-xr-xbin/dotc37
-rwxr-xr-xbin/dotr6
3 files changed, 36 insertions, 35 deletions
diff --git a/bin/common b/bin/common
index b5fd27232..5b1dd177f 100755
--- a/bin/common
+++ b/bin/common
@@ -40,9 +40,9 @@ ERROR_LOG=error.log
trap onTerminate SIGTERM
onTerminate() {
- if [ -f $ERROR_LOG ]; then
- cat $ERROR_LOG
- rm -f $ERROR_LOG
+ if [ -f "$ERROR_LOG" ]; then
+ cat "$ERROR_LOG"
+ rm -f "$ERROR_LOG"
fi
exit 1 # $? is lost from subprocess in command substitution.
}
@@ -52,7 +52,7 @@ function build_jar {
# build_jar package path/to/jar/dir ['/some/sed/command']
#
# Last arg is optional
- cd $DOTTY_ROOT >& /dev/null
+ cd "$DOTTY_ROOT" >& /dev/null
local build_output=$(sbt "$1" || (echo "failed to run: sbt $1" >> $ERROR_LOG; kill -SIGTERM $$))
local jar=$(echo $build_output | sed -n 's/.*Packaging //g; s/ \.\.\..*//g; /^\/.*/p')
@@ -68,14 +68,14 @@ function build_jar {
cd - >& /dev/null
- echo $jar
+ echo "$jar"
}
function update_packages {
- echo "$INTERFACES_JAR" > $DOTTY_ROOT/.packages
- echo "$MAIN_JAR" >> $DOTTY_ROOT/.packages
- echo "$DOTTY_LIB_JAR" >> $DOTTY_ROOT/.packages
- echo "$TEST_JAR" >> $DOTTY_ROOT/.packages
+ echo "$INTERFACES_JAR" > "$DOTTY_ROOT/.packages"
+ echo "$MAIN_JAR" >> "$DOTTY_ROOT/.packages"
+ echo "$DOTTY_LIB_JAR" >> "$DOTTY_ROOT/.packages"
+ echo "$TEST_JAR" >> "$DOTTY_ROOT/.packages"
}
function build_all {
@@ -124,17 +124,17 @@ function check_jar {
local new_files="$(find "$DOTTY_ROOT/$3" \( -iname "*.scala" -o -iname "*.java" \) -newer "$2")"
if [ ! -z "$new_files" ]; then
printf "New files detected in $1, rebuilding..."
- rm $2
+ rm "$2"
eval "$4"
printf "done\n"
update_packages
fi
}
-check_jar "dotty-interfaces" $INTERFACES_JAR "interfaces/src" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
-check_jar "dotty-compiler" $MAIN_JAR "compiler/src" 'MAIN_JAR=$(build_jar dotty-compiler/package compiler/target/scala-$SCALA_BINARY_VERSION)'
-check_jar "dotty-library" $DOTTY_LIB_JAR "library/src" 'DOTTY_LIB_JAR=$(build_jar dotty-library/package library/target/scala-$SCALA_BINARY_VERSION)'
-check_jar "dotty-tests" $TEST_JAR "compiler/test" 'TEST_JAR=$(build_jar dotty-compiler/test:package compiler/target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'
+check_jar "dotty-interfaces" "$INTERFACES_JAR" "interfaces/src" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
+check_jar "dotty-compiler" "$MAIN_JAR" "compiler/src" 'MAIN_JAR=$(build_jar dotty-compiler/package compiler/target/scala-$SCALA_BINARY_VERSION)'
+check_jar "dotty-library" "$DOTTY_LIB_JAR" "library/src" 'DOTTY_LIB_JAR=$(build_jar dotty-library/package library/target/scala-$SCALA_BINARY_VERSION)'
+check_jar "dotty-tests" "$TEST_JAR" "compiler/test" 'TEST_JAR=$(build_jar dotty-compiler/test:package compiler/target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'
# Autodetecting the scala-library location, in case it wasn't provided by an environment variable
if [ "$SCALA_LIBRARY_JAR" == "" ]; then
diff --git a/bin/dotc b/bin/dotc
index 57e97ba5c..ec65903d9 100755
--- a/bin/dotc
+++ b/bin/dotc
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+
# This script is used for running compiler standalone(outside of sbt)
# it's based on miniboxing script and paulp's launcher script
@@ -10,10 +11,10 @@ fi
DOTTY_ROOT="$(dirname "$DOTTY_ROOT")"
DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
-source $DOTTY_ROOT/bin/common
+source "$DOTTY_ROOT/bin/common"
# dotc.build test places bootstrapped jar here
-DOTTY_JAR=$DOTTY_ROOT/dotty.jar
+DOTTY_JAR="$DOTTY_ROOT/dotty.jar"
CompilerMain=dotty.tools.dotc.Main
FromTasty=dotty.tools.dotc.FromTasty
@@ -29,13 +30,13 @@ then
fi
ifdebug () {
- [[ -n $debug ]] && eval "$@"
+ [[ -n "$debug" ]] && eval "$@"
}
echoErr () {
echo >&2 "$@"
}
dlog () {
- [[ -n $debug ]] && echoErr "$@"
+ [[ -n "$debug" ]] && echoErr "$@"
}
die() {
@@ -52,7 +53,7 @@ echoErr ""
execCommand () {
ifdebug echoArgs "$@"
ignore="$(cat "$HOME/.scala_ignore_crashes" 2>/dev/null)"
- if [[ $ignore == "true" ]]; then
+ if [[ "$ignore" == "true" ]]; then
"$@" 2>&1 | scala-crash-filter
else
$@
@@ -62,11 +63,11 @@ execCommand () {
# restore stty settings (echo in particular)
restoreSttySettings () {
dlog "" && dlog "[restore stty] $saved_stty"
- stty $saved_stty && saved_stty=""
+ stty "$saved_stty" && saved_stty=""
}
onExit () {
- [[ -n $saved_stty ]] && restoreSttySettings
+ [[ -n "$saved_stty" ]] && restoreSttySettings
exit $scala_exit_status
}
@@ -103,7 +104,7 @@ addResidual () {
}
onExit() {
- [[ -n $saved_stty ]] && restoreSttySettings
+ [[ -n "$saved_stty" ]] && restoreSttySettings
exit $scala_exit_status
}
@@ -113,8 +114,8 @@ trap onExit INT
# If using the boot classpath, also pass an empty classpath
# to java to suppress "." from materializing.
classpathArgs () {
- if [[ "true" == $bootstrapped ]]; then
- check_jar "dotty-bootstrapped" $DOTTY_JAR "target" 'build_jar "test:runMain dotc.build" target' &> /dev/null
+ if [[ "true" == "$bootstrapped" ]]; then
+ check_jar "dotty-bootstrapped" "$DOTTY_JAR" "target" 'build_jar "test:runMain dotc.build" target' &> /dev/null
toolchain="$DOTTY_JAR:$DOTTY_LIB_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
else
toolchain="$SCALA_LIBRARY_JAR:$DOTTY_LIB_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
@@ -129,7 +130,7 @@ classpathArgs () {
format=windows
fi
- if [[ -n $bootcp ]]; then
+ if [[ -n "$bootcp" ]]; then
boot_classpath="$(cygpath --path --$format "$toolchain:$bcpJars")"
classpath="$(cygpath --path --$format "$cpJars")"
cpArgs="-Xbootclasspath/a:$boot_classpath -classpath $classpath"
@@ -138,7 +139,7 @@ classpathArgs () {
cpArgs="-classpath $classpath"
fi
else
- if [[ -n $bootcp ]]; then
+ if [[ -n "$bootcp" ]]; then
cpArgs="-Xbootclasspath/a:$toolchain:$bcpJars -classpath $cpJars"
else
cpArgs="-classpath $toolchain:$cpJars"
@@ -159,7 +160,7 @@ require_arg () {
}
-main_class=$CompilerMain
+main_class="$CompilerMain"
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -172,11 +173,11 @@ case "$1" in
# Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
-Oshort) addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;;
- -repl) main_class=$ReplMain && shift ;;
- -tasty) main_class=$FromTasty && shift ;;
- -compile) main_class=$CompilerMain && shift ;;
- -run) main_class=$ReplMain && shift ;;
- -fsc) main_class=$FscMain && shift ;;
+ -repl) main_class="$ReplMain" && shift ;;
+ -tasty) main_class="$FromTasty" && shift ;;
+ -compile) main_class="$CompilerMain" && shift ;;
+ -run) main_class="$ReplMain" && shift ;;
+ -fsc) main_class="$FscMain" && shift ;;
-bootcp) bootcp=true && shift ;;
-nobootcp) unset bootcp && shift ;;
-colors) colors=true && shift ;;
diff --git a/bin/dotr b/bin/dotr
index 553b831ca..f00760006 100755
--- a/bin/dotr
+++ b/bin/dotr
@@ -9,7 +9,7 @@ DOTTY_ROOT="$(dirname "$DOTTY_ROOT")"
DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
# Load common functions and variables
-source $DOTTY_ROOT/bin/common
+source "$DOTTY_ROOT"/bin/common
CLASS_PATH="-classpath .:$DOTTY_LIB_JAR:.:$SCALA_LIBRARY_JAR"
@@ -17,7 +17,7 @@ function runMain {
local jbin=$(which "java")
if [ ! -z "$JAVA_BIN" ]; then
- jbin=$JAVA_BIN
+ jbin="$JAVA_BIN"
fi
if [ "$jbin" == "" ]; then
@@ -28,7 +28,7 @@ function runMain {
fi
}
-first_arg=$1
+first_arg="$1"
if [ -z "$1" ]; then
echo "Starting dotty REPL..."