diff options
| author | Matthew Jason Benson <mbenson@apache.org> | 2006-05-03 19:03:21 +0000 |
|---|---|---|
| committer | Matthew Jason Benson <mbenson@apache.org> | 2006-05-03 19:03:21 +0000 |
| commit | 8ceb9e70203e96a33aec8eb360f0dcb05f188d50 (patch) | |
| tree | ac617a3d762cad2e301a4c3eb7c92508ff81e9a0 /src/script | |
| parent | aa0ad7914fa0889b02a975e5b0d5c5a67edeab2c (diff) | |
| download | ant-8ceb9e70203e96a33aec8eb360f0dcb05f188d50.tar.gz | |
strip trailing backslashes from ANT_HOME, CLASSPATH, JIKESPATH. PR# 39300.
fix reversed gotos bypassing run-with-classpath options. PR# 39475.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@399386 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/script')
| -rwxr-xr-x | src/script/ant.bat | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/script/ant.bat b/src/script/ant.bat index dc908426a..00b910c97 100755 --- a/src/script/ant.bat +++ b/src/script/ant.bat @@ -25,12 +25,18 @@ if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat" if "%OS%"=="Windows_NT" @setlocal if "%OS%"=="WINNT" @setlocal -rem %~dp0 is expanded pathname of the current script under NT -set DEFAULT_ANT_HOME=%~dp0.. +if "%ANT_HOME%"=="" goto setDefaultAntHome + +:stripAntHome +if not _%ANT_HOME:~-1%==_\ goto checkClasspath +set ANT_HOME=%ANT_HOME:~0,-1% +goto stripAntHome -if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME% -set DEFAULT_ANT_HOME= +:setDefaultAntHome +rem %~dp0 is expanded pathname of the current script under NT +set ANT_HOME=%~dp0.. +:checkClasspath set _USE_CLASSPATH=yes rem CLASSPATH must not be used if it is equal to "" if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no @@ -58,6 +64,15 @@ rem This label provides a place for the argument list loop to break out rem and for NT handling to skip to. :doneStart + +if _USE_CLASSPATH==no goto findAntHome + +:stripClasspath +if not _%CLASSPATH:~-1%==_\ goto findAntHome +set CLASSPATH=%CLASSPATH:~0,-1% +goto stripClasspath + +:findAntHome rem find ANT_HOME if it does not exist due to either an invalid value passed rem by the user or the %0 problem on Windows 9x if exist "%ANT_HOME%\lib\ant.jar" goto checkJava @@ -99,32 +114,39 @@ if not "%JIKESPATH%"=="" goto runAntWithJikes :runAnt if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath -:runAntNoClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% +:runAntWithClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% rem Check the error code of the Ant build if not "%OS%"=="Windows_NT" goto onError set ANT_ERROR=%ERRORLEVEL% goto end -:runAntWithClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% +:runAntNoClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% rem Check the error code of the Ant build if not "%OS%"=="Windows_NT" goto onError set ANT_ERROR=%ERRORLEVEL% goto end :runAntWithJikes + +if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath +set JIKESPATH=%JIKESPATH:~0,-1% +goto runAntWithJikes + +:checkJikesAndClasspath + if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath -:runAntWithJikesNoClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% +:runAntWithJikesAndClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% rem Check the error code of the Ant build if not "%OS%"=="Windows_NT" goto onError set ANT_ERROR=%ERRORLEVEL% goto end -:runAntWithJikesAndClasspath -"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS% +:runAntWithJikesNoClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% rem Check the error code of the Ant build if not "%OS%"=="Windows_NT" goto onError set ANT_ERROR=%ERRORLEVEL% |
