stevel 2005/01/28 15:18:32
Modified: . WHATSNEW fetch.xml
src/main/org/apache/tools/ant/launch Launcher.java
src/main/org/apache/tools/ant Diagnostics.java
lib libraries.properties
Log:
diagnostics should list lib dir too.
Refactored the constants in the launcher for better sharing.
I worry about the hard coded file separator there (/),
so replaced in the code, but left the constant in,
in case someone was using it.
Updated WHATSNEW. Added which.jar to the fetchables.
Revision Changes Path
1.735 +9 -1 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.734
retrieving revision 1.735
diff -u -r1.734 -r1.735
--- WHATSNEW 28 Jan 2005 09:38:37 -0000 1.734
+++ WHATSNEW 28 Jan 2005 23:18:32 -0000 1.735
@@ -60,7 +60,7 @@
Bugzilla Report 16539.
* Added -nouserlib option to allow running ant without automatically loading
- up ${user.dir}/.lib/ant. This is useful when compiling ant, and antlibs.
+ up ${user.home}/.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
@@ -90,6 +90,14 @@
* Add else attribute to the condition task, which specifies an
optional alternate value to set the property to if the nested
condition evaluates to false. Bugzilla report 33074.
+
+* Added <scriptcondition> condition, for inline scripted conditions
+
+* Added <xor> condition for exclusive-or combining of nested conditions.
+
+* Added <scriptselector> selector for scripted file selection
+
+* ant -diagnostics lists contents of ${user.home}/.ant/lib
Changes from Ant 1.6.2 to current Ant 1.6 CVS version
=====================================================
1.2 +15 -9 ant/fetch.xml
Index: fetch.xml
===================================================================
RCS file: /home/cvs/ant/fetch.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- fetch.xml 20 Jan 2005 23:10:19 -0000 1.1
+++ fetch.xml 28 Jan 2005 23:18:32 -0000 1.2
@@ -16,8 +16,8 @@
and installs them in a location that is accessible the next time Ant runs.
You can choose three locations, by going -Ddest=LOCATION on the command
line
- -Ddest=user user lib dir ${user.home}/.ant/lib --Default--
- -Ddest=system ant lib dir ${ant.home}/lib
+ -Ddest=user user lib dir ${user.home}/.ant/lib
+ -Ddest=system ant lib dir ${ant.home}/lib --Default--
-Ddest=optional optional dir ${ant.home}/lib/optional (for Ant
developers)
You may also need to set proxy settings. This can be done on the command
line,
@@ -60,7 +60,10 @@
<target name="pick-dest">
<condition property="dest.dir"
value="${lib.dir}">
- <equals arg1="${dest}" arg2="system" />
+ <or>
+ <equals arg1="${dest}" arg2="system" />
+ <not><isset property="dest"/></not>
+ </or>
</condition>
<condition property="dest.dir"
value="${optional.dir}">
@@ -68,10 +71,7 @@
</condition>
<condition property="dest.dir"
value="${userlib.dir}">
- <or>
- <equals arg1="${dest}" arg2="user" />
- <not><isset property="dest"/></not>
- </or>
+ <equals arg1="${dest}" arg2="user" />
</condition>
<fail>
Unknown destination : ${dest}
@@ -183,10 +183,16 @@
description="load bsf libraries"
depends="init">
<f project="bsf" />
- </target>
+ </target>
+
+ <target name="debugging"
+ description="internal ant debugging"
+ depends="init">
+ <f project="which" />
+ </target>
<target name="all"
description="load all the libraries"
- depends="logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf" />
+
depends="logging,junit,xml,networking,regexp,antlr,bcel,jdepend,bsf,debugging"
/>
</project>
1.27 +14 -2 ant/src/main/org/apache/tools/ant/launch/Launcher.java
Index: Launcher.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Launcher.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Launcher.java 25 Jan 2005 15:47:57 -0000 1.26
+++ Launcher.java 28 Jan 2005 23:18:32 -0000 1.27
@@ -38,11 +38,22 @@
/** The Ant Library Directory property */
public static final String ANTLIBDIR_PROPERTY = "ant.library.dir";
+ public static final String ANT_PRIVATEDIR = ".ant";
+
+ /**
+ * The location of a per-user library directory
+ */
+ public static final String ANT_PRIVATELIB = "lib";
+
/** The location of a per-user library directory */
- public static final String USER_LIBDIR = ".ant/lib";
+ public static final String USER_LIBDIR = ANT_PRIVATEDIR+"/"+
ANT_PRIVATELIB;
/** The startup class that is to be run */
public static final String MAIN_CLASS = "org.apache.tools.ant.Main";
+ /**
+ * system property with user home directory
+ */
+ public static final String USER_HOMEDIR = "user.home";
/**
* Entry point for starting command line Ant
@@ -191,7 +202,8 @@
URL[] systemJars = Locator.getLocationURLs(antLibDir);
File userLibDir
- = new File(System.getProperty("user.home"), USER_LIBDIR);
+ = new File(System.getProperty(USER_HOMEDIR),
+ ANT_PRIVATEDIR + File.separatorChar + ANT_PRIVATELIB);
URL[] userJars = noUserLib ? new URL[0] :
Locator.getLocationURLs(userLibDir);
1.18 +48 -28 ant/src/main/org/apache/tools/ant/Diagnostics.java
Index: Diagnostics.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Diagnostics.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Diagnostics.java 22 Nov 2004 09:23:26 -0000 1.17
+++ Diagnostics.java 28 Jan 2005 23:18:32 -0000 1.18
@@ -17,6 +17,7 @@
package org.apache.tools.ant;
import org.apache.tools.ant.util.LoaderUtils;
+import org.apache.tools.ant.launch.Launcher;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
@@ -95,20 +96,23 @@
return null;
}
File libDir = new File(home, "lib");
+ return listJarFiles(libDir);
+
+ }
+
+ /**
+ * get a list of all JAR files in a directory
+ * @param libDir directory
+ * @return array of files (or null for no such directory)
+ */
+ private static File[] listJarFiles(File libDir) {
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".jar");
}
};
- // listFiles is JDK 1.2+ method...
- String[] filenames = libDir.list(filter);
- if (filenames == null) {
- return null;
- }
- File[] files = new File[filenames.length];
- for (int i = 0; i < filenames.length; i++) {
- files[i] = new File(libDir, filenames[i]);
- }
+
+ File[] files = libDir.listFiles(filter);
return files;
}
@@ -128,21 +132,8 @@
* '?.?' for JDK 1.0 or 1.1.
*/
private static String getImplementationVersion(Class clazz) {
- try {
- // Package pkg = clazz.getPackage();
- Method method = Class.class.getMethod("getPackage", new Class[0]);
- Object pkg = method.invoke(clazz, (Object[]) null);
- if (pkg != null) {
- // pkg.getImplementationVersion();
- method = pkg.getClass().getMethod("getImplementationVersion",
new Class[0]);
- Object version = method.invoke(pkg, (Object[]) null);
- return (String) version;
- }
- } catch (Exception e) {
- // JDK < 1.2 should land here because the methods above don't
exist.
- return "?.?";
- }
- return null;
+ Package pkg = clazz.getPackage();
+ return pkg.getImplementationVersion();
}
/**
@@ -213,7 +204,7 @@
out.println(Main.getAntVersion());
out.println();
out.println("-------------------------------------------");
- out.println(" Implementation Version (JDK1.2+ only)");
+ out.println(" Implementation Version ");
out.println("-------------------------------------------");
out.println("core tasks : " +
getImplementationVersion(Main.class));
@@ -231,7 +222,13 @@
out.println("-------------------------------------------");
out.println(" ANT_HOME/lib jar listing");
out.println("-------------------------------------------");
- doReportLibraries(out);
+ doReportAntHomeLibraries(out);
+
+ out.println();
+ out.println("-------------------------------------------");
+ out.println(" USER_HOME/.ant/lib jar listing");
+ out.println("-------------------------------------------");
+ doReportUserHomeLibraries(out);
out.println();
out.println("-------------------------------------------");
@@ -278,11 +275,34 @@
* Report the content of ANT_HOME/lib directory
* @param out the stream to print the content to
*/
- private static void doReportLibraries(PrintStream out) {
+ private static void doReportAntHomeLibraries(PrintStream out) {
out.println("ant.home: " + System.getProperty("ant.home"));
File[] libs = listLibraries();
+ printLibraries(libs, out);
+ }
+
+ /**
+ * Report the content of ~/.ant/lib directory
+ *
+ * @param out the stream to print the content to
+ */
+ private static void doReportUserHomeLibraries(PrintStream out) {
+ String home = System.getProperty(Launcher.USER_HOMEDIR);
+ out.println("user.home: " + home);
+ File libDir = new File(home,
+
Launcher.ANT_PRIVATEDIR+File.separator+Launcher.ANT_PRIVATELIB);
+ File[] libs=listJarFiles(libDir);
+ printLibraries(libs, out);
+ }
+
+ /**
+ * list the libraries
+ * @param libs array of libraries (can be null)
+ * @param out output stream
+ */
+ private static void printLibraries(File[] libs, PrintStream out) {
if (libs == null) {
- out.println("Unable to list libraries.");
+ out.println("No such directory.");
return;
}
for (int i = 0; i < libs.length; i++) {
1.2 +1 -0 ant/lib/libraries.properties
Index: libraries.properties
===================================================================
RCS file: /home/cvs/ant/lib/libraries.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libraries.properties 20 Jan 2005 23:10:19 -0000 1.1
+++ libraries.properties 28 Jan 2005 23:18:32 -0000 1.2
@@ -15,6 +15,7 @@
#rhino.version=1.5R5
oro.version=2.0.8
regexp.version=1.3
+which.version=1.0
xerces.version=2.6.2
xalan.version=2.5.1
xml-resolver.version=1.1
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]