From acd0bcd1e0a30b0dca49c4ae0ad3055e97273c66 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Fri, 24 Sep 2004 08:13:25 +0000 Subject: [PATCH] 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 --- WHATSNEW | 4 ++++ build.bat | 2 +- build.sh | 2 +- src/main/org/apache/tools/ant/Main.java | 2 ++ src/main/org/apache/tools/ant/launch/Launcher.java | 5 ++++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index e0cd46910..aed19fa2f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -53,6 +53,10 @@ Other changes: * Added searchpath attribute to for searching path variable(s) 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 ===================================================== diff --git a/build.bat b/build.bat index 3faf80fc3..2452e402c 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 -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 :cleanup diff --git a/build.sh b/build.sh index 98c59f657..f1bfb3731 100755 --- a/build.sh +++ b/build.sh @@ -41,5 +41,5 @@ else ANT_INSTALL="-emacs" fi -bootstrap/bin/ant -lib lib/optional "$ANT_INSTALL" $* +bootstrap/bin/ant -nouserlib -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 784b19a97..fb2276749 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -834,6 +834,8 @@ public class Main implements AntMain { msg.append(" -s the filesystem and use it" + lSep); msg.append(" -nice number A niceness value for the main thread:" + 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()); } diff --git a/src/main/org/apache/tools/ant/launch/Launcher.java b/src/main/org/apache/tools/ant/launch/Launcher.java index e76a96758..d53bc188e 100644 --- a/src/main/org/apache/tools/ant/launch/Launcher.java +++ b/src/main/org/apache/tools/ant/launch/Launcher.java @@ -122,6 +122,7 @@ public class Launcher { String cpString = null; List argList = new ArrayList(); String[] newArgs; + boolean noUserLib = false; for (int i = 0; i < args.length; ++i) { if (args[i].equals("-lib")) { @@ -140,6 +141,8 @@ public class Launcher { + "not be repeated"); } cpString = args[++i]; + } else if (args[i].equals("--nouserlib") || args[i].equals("-nouserlib")) { + noUserLib = true; } else { argList.add(args[i]); } @@ -182,8 +185,8 @@ public class Launcher { File userLibDir = 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; if (toolsJar != null) {