diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/ant/ScalaTool.scala | 19 | ||||
-rw-r--r-- | src/compiler/scala/tools/ant/templates/generic-unix.tmpl | 14 | ||||
-rw-r--r-- | src/compiler/scala/tools/ant/templates/tool-unix.tmpl | 14 |
3 files changed, 30 insertions, 17 deletions
diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala index b079fde680..9e9e8dd309 100644 --- a/src/compiler/scala/tools/ant/ScalaTool.scala +++ b/src/compiler/scala/tools/ant/ScalaTool.scala @@ -181,7 +181,8 @@ package scala.tools.ant { /** Gets the value of the classpath attribute in a Scala-friendly form. * @returns The class path as a list of files. */ private def getWinClasspath: String = - classpath.mkString("", ";", "") + classpath.map(.replace("/", "\\")). + mkString("", ";", "") /** Gets the value of the classpath attribute in a Scala-friendly form. * @returns The class path as a list of files. */ @@ -252,6 +253,16 @@ package scala.tools.ant { writer.close() } + private def expandUnixVar(vars: Map[String,String]): Map[String,String] = + vars.map((key:String,vari:String) => vari. + replaceAll("#([^#]*)#", "\\$$1") + ) + + private def expandWinVar(vars: Map[String,String]): Map[String,String] = + vars.map((key:String,vari:String) => vari. + replaceAll("#([^#]*)#", "%_$1%") + ) + /******************************************************************************\ ** The big execute method ** @@ -275,7 +286,8 @@ package scala.tools.ant { update("javaflags", javaFlags). update("toolflags", toolFlags) if (platforms.contains("unix")) { - val unixPatches = patches.update("classpath", getUnixClasspath) + val unixPatches = expandUnixVar( + patches.update("classpath", getUnixClasspath)) val unixTemplateResource = resourceRoot + "tool-unix.tmpl" val unixTemplate = readResource(unixTemplateResource, unixPatches) writeFile(getFile, unixTemplate) @@ -286,7 +298,8 @@ package scala.tools.ant { } } if (platforms.contains("windows")) { - val winPatches = patches.update("classpath", getWinClasspath) + val winPatches = expandWinVar( + patches.update("classpath", getWinClasspath)) val winTemplateResource = resourceRoot + "tool-windows.tmpl" val winTemplate = readResource(winTemplateResource, winPatches) writeFile(new File(getFile.getAbsolutePath() + ".bat"), winTemplate) diff --git a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl index 066d623854..6f62014138 100644 --- a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl @@ -32,12 +32,12 @@ PREFIX=`dirname "$SOURCE"`/..; prefix=$PREFIX; PREFIX=`cd "$PREFIX"; pwd`; -CP=@classpath@ -if [ "$CP" == "" ] ; then +CLASSPATH=@classpath@ +if [ "$CLASSPATH" == "" ] ; then for jar in `ls $PREFIX/lib/*.jar` ; do - CP=$CP:$jar + CLASSPATH=$CLASSPATH:$jar done - CP=${CP:1} + CLASSPATH=${CLASSPATH:1} fi if $cygwin; then @@ -46,15 +46,15 @@ if $cygwin; then else format=windows fi - CP=`cygpath --path --$format "$CP"` + CLASSPATH=`cygpath --path --$format "$CLASSPATH"` fi for flag in "$@@" ; do if [ $flag == '-version' ] ; then - echo "Scala runtime version @version@" + echo "Scala runtime version @version@ -- @copyright@" ${JAVACMD:=java} -version exit 0 fi done -${JAVACMD:=java} @javaflags@ -cp "$CP" "$@@"
\ No newline at end of file +${JAVACMD:=java} @javaflags@ -Xbootclasspath/a:"$CLASSPATH" "$@@"
\ No newline at end of file diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl index 081b0219da..2dd8c1f7c4 100644 --- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl @@ -32,12 +32,12 @@ PREFIX=`dirname "$SOURCE"`/..; prefix=$PREFIX; PREFIX=`cd "$PREFIX"; pwd`; -CP=@classpath@ -if [ "$CP" == "" ] ; then +CLASSPATH=@classpath@ +if [ "$CLASSPATH" == "" ] ; then for jar in `ls $PREFIX/lib/*.jar` ; do - CP=$CP:$jar + CLASSPATH=$CLASSPATH:$jar done - CP=${CP:1} + CLASSPATH=${CLASSPATH:1} fi if $cygwin; then @@ -46,14 +46,14 @@ if $cygwin; then else format=windows fi - CP=`cygpath --path --$format "$CP"` + CLASSPATH=`cygpath --path --$format "$CLASSPATH"` fi for flag in "$@@" ; do if [ $flag == '-version' ] ; then - echo "@name@ version @version@" + echo "@name@ version @version@ -- @copyright@" exit 0 fi done -${JAVACMD:=java} @javaflags@ -Dscala.home="$PREFIX" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ -cp "$CP" @class@ @toolflags@ "$@@"
\ No newline at end of file +${JAVACMD:=java} @javaflags@ -Dscala.home="$PREFIX" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ -cp "$CLASSPATH" @class@ @toolflags@ "$@@"
\ No newline at end of file |