Browse Source

Add a new option -nouserlib to the ant command.

This allows running ant without loading the jars from ${user.home}/.ant/lib.
This is useful for building ant.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276880 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
acd0bcd1e0
5 changed files with 12 additions and 3 deletions
  1. +4
    -0
      WHATSNEW
  2. +1
    -1
      build.bat
  3. +1
    -1
      build.sh
  4. +2
    -0
      src/main/org/apache/tools/ant/Main.java
  5. +4
    -1
      src/main/org/apache/tools/ant/launch/Launcher.java

+ 4
- 0
WHATSNEW View File

@@ -53,6 +53,10 @@ Other changes:
* Added searchpath attribute to <exec> for searching path variable(s) * Added searchpath attribute to <exec> for searching path variable(s)
when resolveexecutable = true. when resolveexecutable = true.


* Added -nouserlib option to allow running ant without automatically loading
up ${user.dir}/.lib/ant. This is useful when compiling ant, and antlibs.
Modified the 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
===================================================== =====================================================




+ 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 goto cleanup


:install_ant :install_ant
call bootstrap\bin\ant.bat -lib lib/optional -Dant.install="%REAL_ANT_HOME%" %1 %2 %3 %4 %5 %6 %7 %8 %9
call bootstrap\bin\ant.bat -nouserlib -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


+ 1
- 1
build.sh View File

@@ -41,5 +41,5 @@ else
ANT_INSTALL="-emacs" ANT_INSTALL="-emacs"
fi fi


bootstrap/bin/ant -lib lib/optional "$ANT_INSTALL" $*
bootstrap/bin/ant -nouserlib -lib lib/optional "$ANT_INSTALL" $*



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

@@ -834,6 +834,8 @@ public class Main implements AntMain {
msg.append(" -s <file> the filesystem and use it" + lSep); msg.append(" -s <file> the filesystem and use it" + lSep);
msg.append(" -nice number A niceness value for the main thread:" + lSep + msg.append(" -nice number A niceness value for the main thread:" + lSep +
" 1 (lowest) to 10 (highest); 5 is the default" + lSep); " 1 (lowest) to 10 (highest); 5 is the default" + lSep);
msg.append(" -nouserlib Run ant within using the jar files from ${user.home}/"
+ ".ant/lib");
System.out.println(msg.toString()); System.out.println(msg.toString());
} }




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

@@ -122,6 +122,7 @@ public class Launcher {
String cpString = null; String cpString = null;
List argList = new ArrayList(); List argList = new ArrayList();
String[] newArgs; String[] newArgs;
boolean noUserLib = 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")) {
@@ -140,6 +141,8 @@ public class Launcher {
+ "not be repeated"); + "not be repeated");
} }
cpString = args[++i]; cpString = args[++i];
} else if (args[i].equals("--nouserlib") || args[i].equals("-nouserlib")) {
noUserLib = true;
} else { } else {
argList.add(args[i]); argList.add(args[i]);
} }
@@ -182,8 +185,8 @@ public class Launcher {


File userLibDir File userLibDir
= new File(System.getProperty("user.home"), USER_LIBDIR); = new File(System.getProperty("user.home"), USER_LIBDIR);
URL[] userJars = Locator.getLocationURLs(userLibDir);


URL[] userJars = noUserLib ? new URL[0] : Locator.getLocationURLs(userLibDir);


int numJars = libJars.length + userJars.length + systemJars.length; int numJars = libJars.length + userJars.length + systemJars.length;
if (toolsJar != null) { if (toolsJar != null) {


Loading…
Cancel
Save