summaryrefslogblamecommitdiff
path: root/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
blob: 041a0dd5da30e9ad772e4568757cfcef1c2612a2 (plain) (tree)
1
         
















                                                                              
                                                     











                                                       

                                   
 
                                      
                                    
                                       
                                               
                                               
                                      
            
                                                           
          
        

  
                                                                                      
                                
                                  



                                                          


      






                                                                            

                                                                         

  
                                                                                                                                                                                                                                                      
#!/bin/sh

##############################################################################
# @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

# Finding the root folder for this Scala distribution
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`;

# Constructing the extension classpath
EXTENSION_CLASSPATH="@extclasspath@"
if [ -z "$EXTENSION_CLASSPATH" ] ; then
    for ext in `ls -L "$SCALA_HOME"/lib/*` ; do
        if [ -z "$EXTENSION_CLASSPATH" ] ; then
            EXTENSION_CLASSPATH="$ext"
        else
            EXTENSION_CLASSPATH="$EXTENSION_CLASSPATH:$ext"
        fi
    done
fi

# Setting the boot class-path to be the standard library (either as a JAR or a folder)
BOOT_CLASSPATH="@bootclasspath@"
if [ -z "$BOOT_CLASSPATH" ] ; then
    if [ -f "$SCALA_HOME/lib/scala-library.jar" ] ; then
        BOOT_CLASSPATH="$SCALA_HOME/lib/scala-library.jar"
    elif [ -d "$SCALA_HOME/lib/library" ] ; then
        BOOT_CLASSPATH="$SCALA_HOME/lib/library"
    fi
fi

if $cygwin; then
    if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
        format=mixed
    else
        format=windows
    fi
    SCALA_HOME=`cygpath --$format "$SCALA_HOME"`
    EXTENSION_CLASSPATH=`cygpath --path --$format "$EXTENSION_CLASSPATH"`
    BOOT_CLASSPATH=`cygpath --path --$format "$BOOT_CLASSPATH"`
fi

${JAVACMD:=java} @javaflags@ -Xbootclasspath/a:"$BOOT_CLASSPATH" -cp "$EXTENSION_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ @class@ @toolflags@ "$@@"