Browse Source

-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
master
Peter Reilly 20 years ago
parent
commit
d84de6b846
6 changed files with 25 additions and 3 deletions
  1. +4
    -0
      WHATSNEW
  2. +1
    -1
      build.bat
  3. +1
    -1
      build.sh
  4. +1
    -0
      src/main/org/apache/tools/ant/Main.java
  5. +4
    -1
      src/main/org/apache/tools/ant/launch/Launcher.java
  6. +14
    -0
      src/script/ant.bat

+ 4
- 0
WHATSNEW View File

@@ -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
=====================================================



+ 1
- 1
build.bat View File

@@ -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


+ 1
- 1
build.sh View File

@@ -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" $*


+ 1
- 0
src/main/org/apache/tools/ant/Main.java View File

@@ -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());
}



+ 4
- 1
src/main/org/apache/tools/ant/launch/Launcher.java View File

@@ -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);
}



+ 14
- 0
src/script/ant.bat View File

@@ -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



Loading…
Cancel
Save