summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2007-01-03 17:20:09 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2007-01-03 17:20:09 +0000
commit344ba095e17d1cf5ae8c3e82c6409008b3e4f7f2 (patch)
treeb995bc26d0a99d07d4d48f5c37e2efdd9652625d /src/compiler
parentce6fd61e24f0df3dc18fcba08bef62745990259d (diff)
downloadscala-344ba095e17d1cf5ae8c3e82c6409008b3e4f7f2.tar.gz
scala-344ba095e17d1cf5ae8c3e82c6409008b3e4f7f2.tar.bz2
scala-344ba095e17d1cf5ae8c3e82c6409008b3e4f7f2.zip
Removed the generic runner script that has been...
Removed the generic runner script that has been replaced by the MainGenericRunner program.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/ant/ScalaTool.scala45
-rw-r--r--src/compiler/scala/tools/ant/templates/generic-unix.tmpl112
-rw-r--r--src/compiler/scala/tools/ant/templates/generic-windows.tmpl116
3 files changed, 15 insertions, 258 deletions
diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala
index c88939f502..4ea280e7b9 100644
--- a/src/compiler/scala/tools/ant/ScalaTool.scala
+++ b/src/compiler/scala/tools/ant/ScalaTool.scala
@@ -40,8 +40,7 @@ package scala.tools.ant {
* <li>extclasspath,</li>
* <li>properties,</li>
* <li>javaflags,</li>
- * <li>toolflags,</li>
- * <li>genericfile.</li></ul>
+ * <li>toolflags.</li></ul>
*
* @author Gilles Dubochet
* @version 1.0
@@ -69,7 +68,7 @@ package scala.tools.ant {
/** The path to the exec script file. ".bat" will be appended for the
* Windows BAT file, if generated. */
private var file: Option[File] = None
- /** The main class to run. If this is not set, a generic script will be generated */
+ /** The main class to run. */
private var mainClass: Option[String] = None
/** The name of this tool. Can only be set when a main class is defined,
* default this is equal to the file name. */
@@ -89,10 +88,8 @@ package scala.tools.ant {
* "lib/" are automatically added. */
private var extclasspath: List[String] = Nil
/** Comma-separated Java system properties to pass to the JRE. Properties
- * are formated as name=value. Properties scala.home, scala.class.path,
- * scala.boot.class.path and scala.ext.class.path are always set;
- * scala.tool.name and scala.tool.version are set when this script is
- * non-generic. */
+ * are formated as name=value. Properties scala.home, scala.tool.name and
+ * scala.tool.version are always set. */
private var properties: List[Pair[String,String]] = Nil
/** Additional flags passed to the JRE ("java [javaFlags] class"). */
private var javaFlags: String = ""
@@ -334,30 +331,18 @@ package scala.tools.ant {
override def execute() = {
// Tests if all mandatory attributes are set and valid.
if (file.isEmpty) error("Attribute 'file' is not set.")
+ if (mainClass.isEmpty) error("Main class must be set.")
if (platforms.isEmpty) platforms = Platforms.values
- if (mainClass.isEmpty) {
- if (toolFlags != "")
- error("Attribute 'toolflags' cannot be set in a generic file.")
- if (!name.isEmpty)
- error("Attribute 'name' cannot be set in a generic file.")
- val patches = ListMap.Empty.
- update("version", version).
- update("copyright", copyright).
- update("properties", getProperties).
- update("javaflags", javaFlags)
- pipeTemplate("generic", patches)
- } else {
- if (name.isEmpty) name = Some(file.get.getName)
- val patches = ListMap.Empty.
- update("name", name.get).
- update("class", mainClass.get).
- update("version", version).
- update("copyright", copyright).
- update("properties", getProperties).
- update("javaflags", javaFlags).
- update("toolflags", toolFlags)
- pipeTemplate("tool", patches)
- }
+ if (name.isEmpty) name = Some(file.get.getName)
+ val patches = ListMap.Empty.
+ update("name", name.get).
+ update("class", mainClass.get).
+ update("version", version).
+ update("copyright", copyright).
+ update("properties", getProperties).
+ update("javaflags", javaFlags).
+ update("toolflags", toolFlags)
+ pipeTemplate("tool", patches)
}
}
diff --git a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl
deleted file mode 100644
index 008036c858..0000000000
--- a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/bin/sh
-
-##############################################################################
-# Scala runtime @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
-
-# Prints out version if the "-version" flag is passed
-for flag in "$@@" ; do
- #TODO: take version only if it is before the tool class name
- if [ "$flag" = '-version' ] ; then
- echo "Scala runtime version @version@ -- @copyright@"
- ${JAVACMD:=java} -version
- exit 0
- fi
-done
-
-# 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`;
-if $cygwin; then
- SCALA_HOME=`cygpath --windows --short-name "$SCALA_HOME"`
- SCALA_HOME=`cygpath --unix "$SCALA_HOME"`
-fi
-
-# Will contain (at the end of the script) all arguments that weren't explicitly handled
-USER_ARGS=""
-
-# Constructing the user class-path in three overriding steps
-# Step 1: Class-path set to default value "."
-USER_CLASSPATH="."
-# Step 2: Class-path overridden to value of "CLASSPATH" environment variable
-if [ -n "$CLASSPATH" ] ; then
- USER_CLASSPATH="$CLASSPATH"
-fi
-# Step 3: Class-path overridden to value of "-classpath" script parameter
-IS_CP_ARGUMENT=0
-for arg in "$@@" ; do
- if [ "$IS_CP_ARGUMENT" -eq 1 ] ; then
- USER_CLASSPATH=$arg
- IS_CP_ARGUMENT=0
- else
- if [ "$arg" = "-cp" ] || [ "$arg" = "-classpath" ] ; then
- IS_CP_ARGUMENT=1
- else
- USER_ARGS="$USER_ARGS $arg"
- IS_CP_ARGUMENT=0
- fi
- fi
-done
-
-# Constructing the extension classpath
-EXTENSION_CLASSPATH="@extclasspath@"
-if [ -z "$EXTENSION_CLASSPATH" ] ; then
- for ext in `ls -d "$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
-
-# The merge of all non-boot classpaths.
-MERGED_CLASSPATH="$USER_CLASSPATH:$EXTENSION_CLASSPATH"
-
-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"`
- MERGED_CLASSPATH=`cygpath --path --$format "$MERGED_CLASSPATH"`
- BOOT_CLASSPATH=`cygpath --path --$format "$BOOT_CLASSPATH"`
-fi
-
-${JAVACMD:=java} @javaflags@ -Xbootclasspath/a:"$BOOT_CLASSPATH" -cp "$MERGED_CLASSPATH" -Dscala.home="$SCALA_HOME" @properties@ $USER_ARGS
diff --git a/src/compiler/scala/tools/ant/templates/generic-windows.tmpl b/src/compiler/scala/tools/ant/templates/generic-windows.tmpl
deleted file mode 100644
index 3164a3a0ba..0000000000
--- a/src/compiler/scala/tools/ant/templates/generic-windows.tmpl
+++ /dev/null
@@ -1,116 +0,0 @@
-@@echo off
-
-rem ##########################################################################
-rem # Scala runtime @version@
-rem ##########################################################################
-rem # @copyright@
-rem #
-rem # This is free software; see the distribution for copying conditions.
-rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
-rem # PARTICULAR PURPOSE.
-rem ##########################################################################
-
-rem We adopt the following conventions:
-rem - System/user environment variables start with a letter
-rem - Local batch variables start with an underscore ('_')
-
-if "%OS%"=="Windows_NT" (
- @@setlocal
- call :set_home
-) else (
- set _SCALA_HOME=%SCALA_HOME%
- rem The following line tests SCALA_HOME instead of _SCALA_HOME, because
- rem the above change to _SCALA_HOME is not visible within this block.
- if "%SCALA_HOME%"=="" goto error1
-)
-
-rem We use the value of the JAVACMD environment variable if defined
-set _JAVACMD=%JAVACMD%
-if "%_JAVACMD%"=="" set _JAVACMD=java
-
-set _EXTENSION_CLASSPATH=@extclasspath@
-if "%_EXTENSION_CLASSPATH%"=="" (
- for %%f in ("%_SCALA_HOME%\lib\*") do call :add_cpath "%%f"
-)
-
-set _BOOT_CLASSPATH=@bootclasspath@
-if "%_BOOT_CLASSPATH%"=="" (
- if exist "%_SCALA_HOME%\lib\scala-library.jar" (
- set _BOOT_CLASSPATH=%_SCALA_HOME%\lib\scala-library.jar
- )
- if exist "%_SCALA_HOME%\lib\library" (
- set _BOOT_CLASSPATH=%_SCALA_HOME%\lib\library
- )
-)
-
-rem We use the value of the CLASSPATH environment variable if defined
-set _USER_CLASSPATH=%CLASSPATH%
-if "%_USER_CLASSPATH%"=="" set _USER_CLASSPATH=.
-
-set _ARGS=
-:loop
-rem Argument %1 may contain quotes so we use parentheses here
-if (%1)==() goto exec
-if (%1)==(-classpath) goto cpath
-if (%1)==(-cp) goto cpath
-if (%1)==(-version) goto version
-set _ARGS=%_ARGS% %1
-shift
-goto loop
-
-:cpath
-shift
-if (%1)==() goto help
-set _USER_CLASSPATH=%1
-shift
-goto :loop
-
-:exec
-if not "%_EXTENSION_CLASSPATH%"=="" set _MYCLASSPATH=%_USER_CLASSPATH%;%_EXTENSION_CLASSPATH%
-
-rem Variable _USER_CLASSPATH is set to CLASSPATH, %1 or . and DO NOT need to be quoted
-set _PROPS=-Dscala.home="%_SCALA_HOME%" @properties@
-
-rem echo %_JAVACMD% -Xbootclasspath/a:%_BOOT_CLASSPATH% @javaflags@ %_PROPS% -cp %_MYCLASSPATH% %_ARGS%
-%_JAVACMD% -Xbootclasspath/a:%_BOOT_CLASSPATH% @javaflags@ %_PROPS% -cp %_MYCLASSPATH% %_ARGS%
-goto end
-
-:version
-echo Scala runtime version @version@ -- @copyright@
-%_JAVACMD% -version
-goto end
-
-:help
-echo Scala runtime version @version@ -- @copyright@
-%_JAVACMD% -help
-goto end
-
-rem ##########################################################################
-rem # subroutines
-
-:add_cpath
- if "%_EXTENSION_CLASSPATH%"=="" (
- set _EXTENSION_CLASSPATH=%~1
- ) else (
- set _EXTENSION_CLASSPATH=%_EXTENSION_CLASSPATH%;%~1
- )
-goto :eof
-
-rem Variable "%~dps0" works on WinXP SP2 or newer
-rem (see http://support.microsoft.com/?kbid=833431)
-rem set _SCALA_HOME=%~dps0..
-:set_home
- set _BIN_DIR=
- for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi
- set _SCALA_HOME=%_BIN_DIR%..
-goto :eof
-
-rem ##########################################################################
-rem # errors
-
-:error1
-echo ERROR: environment variable SCALA_HOME is undefined. It should point to your installation directory.
-goto end
-
-:end
-if "%OS%"=="Windows_NT" @@endlocal