From 5fe735b785e0d57f574809ad29dbc52273875156 Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Thu, 20 Apr 2006 14:56:21 +0000 Subject: Simplified runner scripts just a bit. --- src/compiler/scala/tools/ant/templates/generic-unix.tmpl | 3 ++- .../scala/tools/ant/templates/generic-windows.tmpl | 2 +- src/compiler/scala/tools/ant/templates/tool-unix.tmpl | 9 +-------- src/compiler/scala/tools/ant/templates/tool-windows.tmpl | 3 +-- src/compiler/scala/tools/nsc/Settings.scala | 16 ++++++++++------ 5 files changed, 15 insertions(+), 18 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl index a55835f5f5..f34e8edc88 100644 --- a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl @@ -89,6 +89,7 @@ if [ "$BOOT_CLASSPATH" != "" ] ; then fi 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 @@ -109,4 +110,4 @@ if $cygwin; then MYCLASSPATH=`cygpath --path --$format "$MYCLASSPATH"` fi -${JAVACMD:=java} @javaflags@ -cp "$MYCLASSPATH" -Dscala.home="$SCALA_HOME" -Dscala.class.path="$USER_CLASSPATH" -Dscala.boot.class.path="$BOOT_CLASSPATH" -Dscala.ext.path="$EXTENSION_CLASSPATH" -Denv.classpath="$CLASSPATH" @properties@ $USER_ARGS +${JAVACMD:=java} @javaflags@ -cp "$MYCLASSPATH" -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 index 8c552132e7..bea794a41a 100644 --- a/src/compiler/scala/tools/ant/templates/generic-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/generic-windows.tmpl @@ -63,7 +63,7 @@ if not "%_EXTENSION_CLASSPATH%"=="" set _MYCLASSPATH=%_USER_CLASSPATH%;%_EXTENSI if not "%_BOOT_CLASSPATH%"=="" set _MYCLASSPATH=%_BOOT_CLASSPATH%;%_MYCLASSPATH% rem Variable _USER_CLASSPATH is set to CLASSPATH, %1 or . and DO NOT need to be quoted -set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dscala.boot.class.path="%_BOOT_CLASSPATH%" -Dscala.class.path=%_USER_CLASSPATH% -Dscala.ext.path="%_EXTENSION_CLASSPATH%" -Denv.classpath="%CLASSPATH%" @properties@ +set _PROPS=-Dscala.home="%_SCALA_HOME%" @properties@ rem echo %_JAVACMD% @javaflags@ %_PROPS% -cp %_MYCLASSPATH% %_ARGS% %_JAVACMD% @javaflags@ %_PROPS% -cp %_MYCLASSPATH% %_ARGS% diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl index c6693fe1ec..538566745b 100644 --- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl @@ -56,13 +56,6 @@ if [ "$BOOT_CLASSPATH" != "" ] ; then fi fi -for flag in "$@@" ; do - if [ "$flag" = '-version' ] ; then - echo "@name@ version @version@ -- @copyright@" - exit 0 - fi -done - if $cygwin; then if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then format=mixed @@ -75,4 +68,4 @@ if $cygwin; then MYCLASSPATH=`cygpath --path --$format "$MYCLASSPATH"` fi -${JAVACMD:=java} @javaflags@ -cp "$MYCLASSPATH" -Dscala.home="$SCALA_HOME" -Dscala.boot.class.path="$BOOT_CLASSPATH" -Dscala.ext.path="$EXTENSION_CLASSPATH" -Denv.classpath="$CLASSPATH" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ @class@ @toolflags@ $@@ +${JAVACMD:=java} @javaflags@ -cp "$MYCLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ @class@ @toolflags@ "$@@" diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl index fc2a784d32..92e8d9826d 100644 --- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl @@ -43,13 +43,12 @@ set _ARGS= :loop rem Argument %1 may contain quotes so we use parentheses here if (%1)==() goto exec -if (%1)==(-version) goto version set _ARGS=%_ARGS% %1 shift goto loop :exec -set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dscala.boot.class.path="%_BOOT_CLASSPATH%" -Dscala.ext.path="%_EXTENSION_CLASSPATH%" -Denv.classpath="%CLASSPATH%" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ +set _PROPS=-Dscala.home="%_SCALA_HOME%" -Denv.classpath="%CLASSPATH%" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ rem echo %_JAVACMD% @javaflags@ %_PROPS% -cp "%_MYCLASSPATH%" @class@ @toolflags@ %_ARGS% %_JAVACMD% @javaflags@ %_PROPS% -cp "%_MYCLASSPATH%" @class@ @toolflags@ %_ARGS% diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index 8b7989bb09..2ada1e9fca 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -28,16 +28,14 @@ class Settings(error: String => unit) { alternatePath( concatPath( getProperty("sun.boot.class.path"), - alternatePath( - getProperty("scala.boot.class.path"), - guessedScalaBootClassPath)), + guessedScalaBootClassPath), "") private val extdirsDefault = alternatePath( concatPath( getProperty("java.ext.dirs"), - getProperty("scala.ext.dirs")), + guessedScalaExtDirs), "") private def alternatePath(p1: String, p2: => String) = @@ -56,6 +54,14 @@ class Settings(error: String => unit) { } else null } + private def guessedScalaExtDirs = { + val scalaHome = System.getProperty("scala.home") + if (scalaHome != null) { + val guess = new File(new File(scalaHome), "lib") + if (guess.exists()) guess.getPath else null + } else null + } + private val encodingDefault = new java.io.OutputStreamWriter( new java.io.ByteArrayOutputStream()).getEncoding @@ -69,8 +75,6 @@ class Settings(error: String => unit) { val noassertions = BooleanSetting("-noassert", "Generate no assertions and assumptions") val verbose = BooleanSetting("-verbose", "Output messages about what the compiler is doing") val classpath = StringSetting ("-classpath", "path", "Specify where to find user class files", classpathDefault) - // This is a hack: it should really be part of the extension path, but since extension only accepts dirs, I add it to the end of classpath. - classpath.value = concatPath(classpath.value, getProperty("scala.ext.path")) val sourcepath = StringSetting ("-sourcepath", "path", "Specify where to find input source files", "") val bootclasspath = StringSetting ("-bootclasspath", "path", "Override location of bootstrap class files", bootclasspathDefault) val extdirs = StringSetting ("-extdirs", "dirs", "Override location of installed extensions", extdirsDefault) -- cgit v1.2.3