Added -noclasspath option to allow running ant WITHOUT using CLASSPATH env variable. Modified ant.bat to do this so that %CLASSPATH% is not looked at. Modified build.sh and build.bat to use the option. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276912 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -60,6 +60,10 @@ Other changes: | |||||
| up ${user.dir}/.lib/ant. This is useful when compiling ant, and antlibs. | up ${user.dir}/.lib/ant. This is useful when compiling ant, and antlibs. | ||||
| Modified the build.sh and build.bat to use the option. | Modified the build.sh and build.bat to use the option. | ||||
| * Added -noclasspath option to allow running ant WITHOUT using CLASSPATH env | |||||
| variable. Modified ant.bat to do this so that %CLASSPATH% is not looked at. | |||||
| Modified build.sh and build.bat to use the option. | |||||
| Changes from Ant 1.6.2 to current Ant 1.6 CVS version | Changes from Ant 1.6.2 to current Ant 1.6 CVS version | ||||
| ===================================================== | ===================================================== | ||||
| @@ -17,7 +17,7 @@ call bootstrap\bin\ant.bat -lib lib/optional %1 %2 %3 %4 %5 %6 %7 %8 %9 | |||||
| goto cleanup | goto cleanup | ||||
| :install_ant | :install_ant | ||||
| call bootstrap\bin\ant.bat -nouserlib -lib lib/optional -Dant.install="%REAL_ANT_HOME%" %1 %2 %3 %4 %5 %6 %7 %8 %9 | |||||
| call bootstrap\bin\ant.bat -nouserlib -noclasspath -lib lib/optional -Dant.install="%REAL_ANT_HOME%" %1 %2 %3 %4 %5 %6 %7 %8 %9 | |||||
| rem clean up | rem clean up | ||||
| :cleanup | :cleanup | ||||
| @@ -41,5 +41,5 @@ else | |||||
| ANT_INSTALL="-emacs" | ANT_INSTALL="-emacs" | ||||
| fi | fi | ||||
| bootstrap/bin/ant -nouserlib -lib lib/optional "$ANT_INSTALL" $* | |||||
| bootstrap/bin/ant -nouserlib -noclasspath -lib lib/optional "$ANT_INSTALL" $* | |||||
| @@ -840,6 +840,7 @@ public class Main implements AntMain { | |||||
| + lSep); | + lSep); | ||||
| msg.append(" -nouserlib Run ant without using the jar files from ${user.home}/" | msg.append(" -nouserlib Run ant without using the jar files from ${user.home}/" | ||||
| + ".ant/lib"); | + ".ant/lib"); | ||||
| msg.append(" -noclasspath Run ant without using CLASSPATH"); | |||||
| System.out.println(msg.toString()); | System.out.println(msg.toString()); | ||||
| } | } | ||||
| @@ -123,6 +123,7 @@ public class Launcher { | |||||
| List argList = new ArrayList(); | List argList = new ArrayList(); | ||||
| String[] newArgs; | String[] newArgs; | ||||
| boolean noUserLib = false; | boolean noUserLib = false; | ||||
| boolean noClassPath = false; | |||||
| for (int i = 0; i < args.length; ++i) { | for (int i = 0; i < args.length; ++i) { | ||||
| if (args[i].equals("-lib")) { | if (args[i].equals("-lib")) { | ||||
| @@ -143,6 +144,8 @@ public class Launcher { | |||||
| cpString = args[++i]; | cpString = args[++i]; | ||||
| } else if (args[i].equals("--nouserlib") || args[i].equals("-nouserlib")) { | } else if (args[i].equals("--nouserlib") || args[i].equals("-nouserlib")) { | ||||
| noUserLib = true; | noUserLib = true; | ||||
| } else if (args[i].equals("--noclasspath") || args[i].equals("-noclasspath")) { | |||||
| noClassPath = true; | |||||
| } else { | } else { | ||||
| argList.add(args[i]); | argList.add(args[i]); | ||||
| } | } | ||||
| @@ -156,7 +159,7 @@ public class Launcher { | |||||
| List libPathURLs = new ArrayList(); | List libPathURLs = new ArrayList(); | ||||
| if (cpString != null) { | |||||
| if (cpString != null && !noClassPath) { | |||||
| addPath(cpString, false, libPathURLs); | addPath(cpString, false, libPathURLs); | ||||
| } | } | ||||
| @@ -25,6 +25,8 @@ set DEFAULT_ANT_HOME=%~dp0.. | |||||
| if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME% | if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME% | ||||
| set DEFAULT_ANT_HOME= | set DEFAULT_ANT_HOME= | ||||
| set _USE_CLASSPATH=yes | |||||
| rem Slurp the command line arguments. This loop allows for an unlimited number | rem Slurp the command line arguments. This loop allows for an unlimited number | ||||
| rem of arguments (up to the command line limit, anyway). | rem of arguments (up to the command line limit, anyway). | ||||
| set ANT_CMD_LINE_ARGS=%1 | set ANT_CMD_LINE_ARGS=%1 | ||||
| @@ -32,9 +34,17 @@ if ""%1""=="""" goto doneStart | |||||
| shift | shift | ||||
| :setupArgs | :setupArgs | ||||
| if ""%1""=="""" goto doneStart | if ""%1""=="""" goto doneStart | ||||
| if ""%1""==""-noclasspath"" goto clearclasspath | |||||
| set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 | set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 | ||||
| shift | shift | ||||
| goto setupArgs | goto setupArgs | ||||
| rem here is there is a -noclasspath in the options | |||||
| :clearclasspath | |||||
| set _USE_CLASSPATH=no | |||||
| shift | |||||
| goto setupArgs | |||||
| rem This label provides a place for the argument list loop to break out | rem This label provides a place for the argument list loop to break out | ||||
| rem and for NT handling to skip to. | rem and for NT handling to skip to. | ||||
| @@ -79,6 +89,7 @@ if "%_JAVACMD%" == "" set _JAVACMD=java.exe | |||||
| if not "%JIKESPATH%"=="" goto runAntWithJikes | if not "%JIKESPATH%"=="" goto runAntWithJikes | ||||
| :runAnt | :runAnt | ||||
| if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath | |||||
| if not "%CLASSPATH%"=="" goto runAntWithClasspath | if not "%CLASSPATH%"=="" goto runAntWithClasspath | ||||
| "%_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% | "%_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% | ||||
| goto end | goto end | ||||
| @@ -88,7 +99,10 @@ goto end | |||||
| goto end | goto end | ||||
| :runAntWithJikes | :runAntWithJikes | ||||
| if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath | |||||
| if not "%CLASSPATH%"=="" goto runAntWithJikesAndClasspath | if not "%CLASSPATH%"=="" goto runAntWithJikesAndClasspath | ||||
| :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% | "%_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% | ||||
| goto end | goto end | ||||