summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Reilly <peterreilly@apache.org>2004-10-05 08:37:01 +0000
committerPeter Reilly <peterreilly@apache.org>2004-10-05 08:37:01 +0000
commitd84de6b84688e0235a43fdf08ec0212239b0c159 (patch)
treebd2f19c8a321a2f648fc58dc6960ac36f71d1317
parentf6c27e5849c51b841f64a946447a3c171b18d9fc (diff)
downloadant-d84de6b84688e0235a43fdf08ec0212239b0c159.tar.gz
-noclasspath 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. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276912 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--WHATSNEW4
-rwxr-xr-xbuild.bat2
-rwxr-xr-xbuild.sh2
-rw-r--r--src/main/org/apache/tools/ant/Main.java1
-rw-r--r--src/main/org/apache/tools/ant/launch/Launcher.java5
-rwxr-xr-xsrc/script/ant.bat14
6 files changed, 25 insertions, 3 deletions
diff --git a/WHATSNEW b/WHATSNEW
index 8734014dc..836a13794 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -60,6 +60,10 @@ Other changes:
up ${user.dir}/.lib/ant. This is useful when compiling ant, and antlibs.
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
=====================================================
diff --git a/build.bat b/build.bat
index 2452e402c..c5b6ec092 100755
--- a/build.bat
+++ b/build.bat
@@ -17,7 +17,7 @@ call bootstrap\bin\ant.bat -lib lib/optional %1 %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup
: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
:cleanup
diff --git a/build.sh b/build.sh
index f1bfb3731..52a026db5 100755
--- a/build.sh
+++ b/build.sh
@@ -41,5 +41,5 @@ else
ANT_INSTALL="-emacs"
fi
-bootstrap/bin/ant -nouserlib -lib lib/optional "$ANT_INSTALL" $*
+bootstrap/bin/ant -nouserlib -noclasspath -lib lib/optional "$ANT_INSTALL" $*
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 998d6e039..34b803144 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -840,6 +840,7 @@ public class Main implements AntMain {
+ lSep);
msg.append(" -nouserlib Run ant without using the jar files from ${user.home}/"
+ ".ant/lib");
+ msg.append(" -noclasspath Run ant without using CLASSPATH");
System.out.println(msg.toString());
}
diff --git a/src/main/org/apache/tools/ant/launch/Launcher.java b/src/main/org/apache/tools/ant/launch/Launcher.java
index 25110b410..8abf81f28 100644
--- a/src/main/org/apache/tools/ant/launch/Launcher.java
+++ b/src/main/org/apache/tools/ant/launch/Launcher.java
@@ -123,6 +123,7 @@ public class Launcher {
List argList = new ArrayList();
String[] newArgs;
boolean noUserLib = false;
+ boolean noClassPath = false;
for (int i = 0; i < args.length; ++i) {
if (args[i].equals("-lib")) {
@@ -143,6 +144,8 @@ public class Launcher {
cpString = args[++i];
} else if (args[i].equals("--nouserlib") || args[i].equals("-nouserlib")) {
noUserLib = true;
+ } else if (args[i].equals("--noclasspath") || args[i].equals("-noclasspath")) {
+ noClassPath = true;
} else {
argList.add(args[i]);
}
@@ -156,7 +159,7 @@ public class Launcher {
List libPathURLs = new ArrayList();
- if (cpString != null) {
+ if (cpString != null && !noClassPath) {
addPath(cpString, false, libPathURLs);
}
diff --git a/src/script/ant.bat b/src/script/ant.bat
index d61f4756e..d78839092 100755
--- a/src/script/ant.bat
+++ b/src/script/ant.bat
@@ -25,6 +25,8 @@ set DEFAULT_ANT_HOME=%~dp0..
if "%ANT_HOME%"=="" set ANT_HOME=%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 of arguments (up to the command line limit, anyway).
set ANT_CMD_LINE_ARGS=%1
@@ -32,9 +34,17 @@ if ""%1""=="""" goto doneStart
shift
:setupArgs
if ""%1""=="""" goto doneStart
+if ""%1""==""-noclasspath"" goto clearclasspath
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift
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 and for NT handling to skip to.
@@ -79,6 +89,7 @@ if "%_JAVACMD%" == "" set _JAVACMD=java.exe
if not "%JIKESPATH%"=="" goto runAntWithJikes
:runAnt
+if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath
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%
goto end
@@ -88,7 +99,10 @@ goto end
goto end
:runAntWithJikes
+if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath
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%
goto end