From be3e84bd0983f01dde5c44f4eb8f749a12ad2159 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 12 May 2016 10:20:24 +0200 Subject: Add dotty runner script able to run dotty-compiled class with `main` --- bin/dotty | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 bin/dotty diff --git a/bin/dotty b/bin/dotty new file mode 100755 index 000000000..3d8a6697a --- /dev/null +++ b/bin/dotty @@ -0,0 +1,25 @@ +#!/bin/bash + +# Try to autodetect real location of the script +DOTTY_ROOT="`readlink \"$0\"`" # relative, symbolic links resolved +if [[ "$DOTTY_ROOT" == "" ]]; then + DOTTY_ROOT="$0" +fi +DOTTY_ROOT="`dirname \"$DOTTY_ROOT\"`" +DOTTY_ROOT="`( cd \"$DOTTY_ROOT\" && pwd )`/.." # absolute + +# CLASS_PATH is derived from the DOTTY_ROOT +CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/" + +function runMain { + scala $CLASS_PATH $@ +} + +if [ -z "$1" ]; then + echo "usage: $0 MainClass args" + echo "" + echo " missing class argument" + exit 1 +else + runMain "$@" +fi -- cgit v1.2.3 From 5004ae26f167dc30530e65f763af673bac158ebc Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 12 May 2016 10:35:39 +0200 Subject: Start REPL on no args in dotty script, fix backticks --- bin/dotc | 6 +++--- bin/dotty | 25 ------------------------- bin/dottyr | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 28 deletions(-) delete mode 100755 bin/dotty create mode 100755 bin/dottyr diff --git a/bin/dotc b/bin/dotc index c52abc3d4..7f98f017b 100755 --- a/bin/dotc +++ b/bin/dotc @@ -3,12 +3,12 @@ # it's based on miniboxing script and paulp's launcher script # Try to autodetect real location of the script -DOTTY_ROOT="`readlink \"$0\"`" # relative, symbolic links resolved +DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved if [[ "$DOTTY_ROOT" == "" ]]; then DOTTY_ROOT="$0" fi -DOTTY_ROOT="`dirname \"$DOTTY_ROOT\"`" -DOTTY_ROOT="`( cd \"$DOTTY_ROOT\" >& /dev/null && pwd )`/.." # absolute +DOTTY_ROOT="$(dirname "$DOTTY_ROOT")" +DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute # Finds in dotty build file a line containing PATTERN # returns last "" escaped string in this line diff --git a/bin/dotty b/bin/dotty deleted file mode 100755 index 3d8a6697a..000000000 --- a/bin/dotty +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Try to autodetect real location of the script -DOTTY_ROOT="`readlink \"$0\"`" # relative, symbolic links resolved -if [[ "$DOTTY_ROOT" == "" ]]; then - DOTTY_ROOT="$0" -fi -DOTTY_ROOT="`dirname \"$DOTTY_ROOT\"`" -DOTTY_ROOT="`( cd \"$DOTTY_ROOT\" && pwd )`/.." # absolute - -# CLASS_PATH is derived from the DOTTY_ROOT -CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/" - -function runMain { - scala $CLASS_PATH $@ -} - -if [ -z "$1" ]; then - echo "usage: $0 MainClass args" - echo "" - echo " missing class argument" - exit 1 -else - runMain "$@" -fi diff --git a/bin/dottyr b/bin/dottyr new file mode 100755 index 000000000..cac1114b2 --- /dev/null +++ b/bin/dottyr @@ -0,0 +1,23 @@ +#!/bin/bash + +# Try to autodetect real location of the script +DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved +if [[ "$DOTTY_ROOT" == "" ]]; then + DOTTY_ROOT="$0" +fi +DOTTY_ROOT="$(dirname "$DOTTY_ROOT")" +DOTTY_ROOT="$( cd "$DOTTY_ROOT" && pwd )/.." # absolute + +# CLASS_PATH is derived from the DOTTY_ROOT +CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/" + +function runMain { + scala $CLASS_PATH $@ +} + +if [ -z "$1" ]; then + echo "Starting dotty REPL..." + eval "$DOTTY_ROOT/bin/dotc -repl" +else + runMain "$@" +fi -- cgit v1.2.3 From c7f58dd7f0d76965a33378626ddeed3d8915d0d8 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 19 May 2016 16:18:25 +0200 Subject: Rename `dotty` script to `dotr` --- bin/dotr | 23 +++++++++++++++++++++++ bin/dottyr | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) create mode 100755 bin/dotr delete mode 100755 bin/dottyr diff --git a/bin/dotr b/bin/dotr new file mode 100755 index 000000000..cac1114b2 --- /dev/null +++ b/bin/dotr @@ -0,0 +1,23 @@ +#!/bin/bash + +# Try to autodetect real location of the script +DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved +if [[ "$DOTTY_ROOT" == "" ]]; then + DOTTY_ROOT="$0" +fi +DOTTY_ROOT="$(dirname "$DOTTY_ROOT")" +DOTTY_ROOT="$( cd "$DOTTY_ROOT" && pwd )/.." # absolute + +# CLASS_PATH is derived from the DOTTY_ROOT +CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/" + +function runMain { + scala $CLASS_PATH $@ +} + +if [ -z "$1" ]; then + echo "Starting dotty REPL..." + eval "$DOTTY_ROOT/bin/dotc -repl" +else + runMain "$@" +fi diff --git a/bin/dottyr b/bin/dottyr deleted file mode 100755 index cac1114b2..000000000 --- a/bin/dottyr +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Try to autodetect real location of the script -DOTTY_ROOT="$(readlink "$0")" # relative, symbolic links resolved -if [[ "$DOTTY_ROOT" == "" ]]; then - DOTTY_ROOT="$0" -fi -DOTTY_ROOT="$(dirname "$DOTTY_ROOT")" -DOTTY_ROOT="$( cd "$DOTTY_ROOT" && pwd )/.." # absolute - -# CLASS_PATH is derived from the DOTTY_ROOT -CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/" - -function runMain { - scala $CLASS_PATH $@ -} - -if [ -z "$1" ]; then - echo "Starting dotty REPL..." - eval "$DOTTY_ROOT/bin/dotc -repl" -else - runMain "$@" -fi -- cgit v1.2.3 From 3c638451ba9842e33c5e0b83433ca406c64a3bb4 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 26 May 2016 11:54:51 +0200 Subject: silence `cd` in script --- bin/dotr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dotr b/bin/dotr index cac1114b2..ee113b706 100755 --- a/bin/dotr +++ b/bin/dotr @@ -6,7 +6,7 @@ if [[ "$DOTTY_ROOT" == "" ]]; then DOTTY_ROOT="$0" fi DOTTY_ROOT="$(dirname "$DOTTY_ROOT")" -DOTTY_ROOT="$( cd "$DOTTY_ROOT" && pwd )/.." # absolute +DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute # CLASS_PATH is derived from the DOTTY_ROOT CLASS_PATH="-J-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-2.11/classes/" -- cgit v1.2.3