From 74d770b456e0d907b35fae994ee4acb4a7fd3d63 Mon Sep 17 00:00:00 2001 From: michelou Date: Sat, 11 Mar 2006 18:13:53 +0000 Subject: corrected missing path conversion on Cygwin for... corrected missing path conversion on Cygwin for file 'generic-unix.tmpl' added handling of option '-cp/-classpath' in file 'tool-windows.tmpl ' use task instead of on Windows in file 'build.xml ' --- build.xml | 9 ++- .../scala/tools/ant/templates/generic-unix.tmpl | 64 +++++++++------------- .../scala/tools/ant/templates/generic-windows.tmpl | 6 +- .../scala/tools/ant/templates/tool-windows.tmpl | 31 +++++++++-- 4 files changed, 64 insertions(+), 46 deletions(-) diff --git a/build.xml b/build.xml index 0034344595..e714da7345 100644 --- a/build.xml +++ b/build.xml @@ -992,15 +992,20 @@ GENERATES A DISTRIBUTION - + + + + + + - + diff --git a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl index a96d4db464..0209f62c37 100644 --- a/src/compiler/scala/tools/ant/templates/generic-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/generic-unix.tmpl @@ -41,37 +41,41 @@ SCALA_HOME=`cd "$SCALA_HOME"; pwd`; MYCLASSPATH=@classpath@ if [ "$MYCLASSPATH" == "" ] ; then - for jar in `ls $SCALA_HOME/lib/*.jar` ; do - MYCLASSPATH="$MYCLASSPATH:$jar" - done - MYCLASSPATH=${MYCLASSPATH:1} + for jar in `ls $SCALA_HOME/lib/*.jar` ; do + MYCLASSPATH="$MYCLASSPATH:$jar" + done + MYCLASSPATH=${MYCLASSPATH:1} fi QQ_USERCLASSPATH="." QQ_USERARGS="" 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_USERARGS="$QQ_USERARGS $i" +for i in $@@ ; do + if [ $QQ_NEXT -eq 1 ] ; then + QQ_USERCLASSPATH=$i QQ_NEXT=0 - fi - fi + else + if [[ $i = "-cp" || $i = "-classpath" ]] ; then + QQ_NEXT=1 + else + QQ_USERARGS="$QQ_USERARGS $i" + QQ_NEXT=0 + fi + fi done -#echo $ARGS -#for j in $ARGS -#do -# echo $j -#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 @@ -79,21 +83,7 @@ if $cygwin; then else format=windows fi - CLASSPATH=`cygpath --path --$format "$CLASSPATH"` -fi - -## Lex suggested the userclasspath come before our stuff, since it gets -## preferred. - -if [ "$QQ_USERCLASSPATH" != "." ] -then - MYCLASSPATH="$QQ_USERCLASSPATH:$MYCLASSPATH" -else if [ "$CLASSPATH" != "" ] - then - MYCLASSPATH="$CLASSPATH:$MYCLASSPATH" - else - MYCLASSPATH=".:$MYCLASSPATH" - fi + MYCLASSPATH=`cygpath --path --$format "$MYCLASSPATH"` fi QQ_USERARGS="-cp $MYCLASSPATH $QQ_USERARGS" diff --git a/src/compiler/scala/tools/ant/templates/generic-windows.tmpl b/src/compiler/scala/tools/ant/templates/generic-windows.tmpl index 41a4d6e6a4..10f3fbd5c2 100644 --- a/src/compiler/scala/tools/ant/templates/generic-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/generic-windows.tmpl @@ -8,6 +8,10 @@ rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A rem # PARTICULAR PURPOSE. rem ########################################################################## +rem We assume the following conventions: +rem - System/user environment variables start with a letter +rem - Local batch variables start with a '_' + if "%OS%"=="Windows_NT" ( @@setlocal set _SCALA_HOME=%~dp0.. @@ -74,7 +78,7 @@ rem ########################################################################## rem # errors :error1 -echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-@version@". +echo ERROR: environment variable SCALA_HOME is undefined. It should point to your installation directory. goto end :end diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl index 5c204bb49b..e85693d5d9 100644 --- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl @@ -8,34 +8,49 @@ rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A rem # PARTICULAR PURPOSE. rem ########################################################################## +rem We assume the following conventions: +rem - System/user environment variables start with a letter +rem - Local batch variables start with a '_' + if "%OS%"=="Windows_NT" ( @@setlocal - set SCALA_HOME=%~dp0..% + set _SCALA_HOME=%~dp0.. ) else ( - if "%SCALA_HOME%"=="" goto error1 + set _SCALA_HOME=%SCALA_HOME% + if "%_SCALA_HOME%"=="" goto error1 ) -set _SCALA_HOME=%SCALA_HOME% set _JAVACMD=%JAVACMD% if "%_JAVACMD%"=="" set _JAVACMD=java set _JAVAFLAGS=@javaflags@ +set _CPATH=. set _CLASSPATH=@classpath@ if not "%_CLASSPATH%"=="" goto args -for %%f in ("%SCALA_HOME%\lib\*.jar") do call :add_cpath "%%f" +for %%f in ("%_SCALA_HOME%\lib\*.jar") do call :add_cpath "%%f" :args set _ARGS= :loop 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 _CPATH=%1 +shift +goto :loop + :exec -set _PROPS=-Dscala.home="%SCALA_HOME%" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ +set _PROPS=-Dscala.home="%_SCALA_HOME%" -Dscala.tool.name="@name@" -Dscala.tool.version="@version@" @properties@ +set _CLASSPATH=%_CPATH%;%_CLASSPATH% rem echo %_JAVACMD% %_JAVAFLAGS% %_PROPS% -cp "%_CLASSPATH%" @class@ @toolflags@ %_ARGS% %_JAVACMD% %_JAVAFLAGS% %_PROPS% -cp "%_CLASSPATH%" @class@ @toolflags@ %_ARGS% goto end @@ -44,6 +59,10 @@ goto end echo @name@ version @version@ -- @copyright@ goto end +:help +echo @name@ version @version@ -- @copyright@ +goto end + rem ########################################################################## rem # subroutines @@ -59,7 +78,7 @@ rem ########################################################################## rem # errors :error1 -echo ERROR: environment variable SCALA_HOME is undefined. It should point to your sbaz directory. +echo ERROR: environment variable SCALA_HOME is undefined. It should point to your installation directory. goto end :end -- cgit v1.2.3