summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2006-03-16 07:55:55 +0000
committerBurak Emir <emir@epfl.ch>2006-03-16 07:55:55 +0000
commit4bf7da4f43d2f7c064bc499e3a96fed678635791 (patch)
tree11af42bbf57229e16fa6c73a5a9a521a06614971 /src
parent2b54dff2c28f8dfd200fb52af2ce96090e2f18e9 (diff)
downloadscala-4bf7da4f43d2f7c064bc499e3a96fed678635791.tar.gz
scala-4bf7da4f43d2f7c064bc499e3a96fed678635791.tar.bz2
scala-4bf7da4f43d2f7c064bc499e3a96fed678635791.zip
unix script to call the interpreter
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/ant/templates/int-unix.tmpl99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/ant/templates/int-unix.tmpl b/src/compiler/scala/tools/ant/templates/int-unix.tmpl
new file mode 100644
index 0000000000..7a78d65258
--- /dev/null
+++ b/src/compiler/scala/tools/ant/templates/int-unix.tmpl
@@ -0,0 +1,99 @@
+#!/bin/bash
+
+##############################################################################
+# @name@ @version@
+##############################################################################
+# @copyright@
+# This is free software; see the distribution for copying conditions.
+# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+##############################################################################
+
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ Darwin*) darwin=true ;;
+esac
+
+SOURCE=$0;
+SCRIPT=`basename "$SOURCE"`;
+while [ -h "$SOURCE" ]; do
+ SCRIPT=`basename "$SOURCE"`;
+ LOOKUP=`ls -ld "$SOURCE"`;
+ TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`;
+ if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then
+ SOURCE=${TARGET:-.};
+ else
+ SOURCE=`dirname "$SOURCE"`/${TARGET:-.};
+ fi;
+done;
+SCALA_HOME=`dirname "$SOURCE"`/..;
+SCALA_HOME=`cd "$SCALA_HOME"; pwd`;
+
+## buraq: previous version of this script computed the MYCLASSPATH and
+## then appended it to the bootclasspath. Unfortunately, this
+## won't work for library code that uses reflection to obtain
+## a class living on the classpath. For this reason, we have
+## to merge everything in the -cp classpath. This requires
+## intercepting the user's -cp, if any, or the user's $CLASSPATH,
+## if set, appending our libs to it and passing the whole thing by -cp
+
+MYCLASSPATH=@classpath@
+if [ "$MYCLASSPATH" == "" ] ; then
+ for jar in `ls $SCALA_HOME/lib/*.jar` ; do
+ MYCLASSPATH="$MYCLASSPATH:$jar"
+ done
+ MYCLASSPATH=${MYCLASSPATH:1}
+fi
+
+QQ_USERCLASSPATH="."
+QQ_USERARGS=""
+QQ_OTHER=""
+QQ_NEXT=0
+for i in $@@ ; do
+ if [ $QQ_NEXT -eq 1 ] ; then
+ QQ_USERCLASSPATH=$i
+ QQ_NEXT=0
+ else
+ if [[ $i = "-cp" || $i = "-classpath" ]] ; then
+ QQ_NEXT=1
+ else
+ QQ_OTHER="$QQ_OTHER $i"
+ QQ_NEXT=0
+ fi
+ fi
+done
+
+## Lex suggested the user classpath comes before
+## the Scala libraries, since it gets preferred.
+
+if [ "$QQ_USERCLASSPATH" != "." ] ; then
+ MYCLASSPATH="$QQ_USERCLASSPATH:$MYCLASSPATH"
+else
+ if [ "$CLASSPATH" != "" ] ; then
+ MYCLASSPATH="$CLASSPATH:$MYCLASSPATH"
+ else
+ MYCLASSPATH=".:$MYCLASSPATH"
+ fi
+fi
+
+if $cygwin; then
+ if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
+ format=mixed
+ else
+ format=windows
+ fi
+ MYCLASSPATH=`cygpath --path --$format "$MYCLASSPATH"`
+fi
+
+QQ_USERARGS="-cp $MYCLASSPATH $QQ_USERARGS"
+
+for flag in "$@@" ; do
+ if [ "$flag" == '-version' ] ; then
+ echo "@name@ version @version@ -- @copyright@"
+ exit 0
+ fi
+done
+
+${JAVACMD:=java} @javaflags@ -Dscala.home="$SCALA_HOME" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ $QQ_USERARGS @class@ @toolflags@ $QQ_OTHER