diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java index e65cbc616..5803aa8f9 100644 --- a/src/main/org/apache/tools/ant/DefaultLogger.java +++ b/src/main/org/apache/tools/ant/DefaultLogger.java @@ -191,10 +191,14 @@ public class DefaultLogger implements BuildLogger { if (minutes > 0) { - return Long.toString(minutes) + " minutes " + Long.toString(seconds%60) + " seconds"; + return Long.toString(minutes) + " minute" + + (minutes == 1 ? " " : "s ") + + Long.toString(seconds%60) + " second" + + (seconds%60 == 1 ? "" : "s"); } else { - return Long.toString(seconds) + " seconds"; + return Long.toString(seconds) + " second" + + (seconds%60 == 1 ? "" : "s"); } } diff --git a/src/main/org/apache/tools/ant/XmlLogger.java b/src/main/org/apache/tools/ant/XmlLogger.java index 06696f580..34580ef01 100644 --- a/src/main/org/apache/tools/ant/XmlLogger.java +++ b/src/main/org/apache/tools/ant/XmlLogger.java @@ -118,7 +118,7 @@ public class XmlLogger implements BuildListener { public void buildFinished(BuildEvent event) { long totalTime = System.currentTimeMillis() - buildStartTime; - buildElement.setAttribute(TIME_ATTR, formatTime(totalTime)); + buildElement.setAttribute(TIME_ATTR, DefaultLogger.formatTime(totalTime)); if (event.getException() != null) { buildElement.setAttribute(ERROR_ATTR, event.getException().toString()); @@ -156,7 +156,7 @@ public class XmlLogger implements BuildListener { public void targetFinished(BuildEvent event) { long totalTime = System.currentTimeMillis() - targetStartTime; - targetElement.setAttribute(TIME_ATTR, formatTime(totalTime)); + targetElement.setAttribute(TIME_ATTR, DefaultLogger.formatTime(totalTime)); if (taskElement == null) { buildElement.appendChild(targetElement); } else { @@ -192,7 +192,7 @@ public class XmlLogger implements BuildListener { public void taskFinished(BuildEvent event) { long totalTime = System.currentTimeMillis() - taskStartTime; - taskElement.setAttribute(TIME_ATTR, formatTime(totalTime)); + taskElement.setAttribute(TIME_ATTR, DefaultLogger.formatTime(totalTime)); targetElement.appendChild(taskElement); taskElement = null; @@ -287,18 +287,4 @@ public class XmlLogger implements BuildListener { out.write(element.getTagName()); out.write(">\n"); } - - private static String formatTime(long millis) { - long seconds = millis / 1000; - long minutes = seconds / 60; - - - if (minutes > 0) { - return Long.toString(minutes) + " minutes " + Long.toString(seconds%60) + " seconds"; - } - else { - return Long.toString(seconds) + " seconds"; - } - - } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Copydir.java b/src/main/org/apache/tools/ant/taskdefs/Copydir.java index 0b1cd8594..e1a2ccde8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copydir.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copydir.java @@ -118,8 +118,9 @@ public class Copydir extends MatchingTask { String[] files = ds.getIncludedFiles(); scanDir(srcDir, destDir, files); if (filecopyList.size() > 0) { - log("Copying " + filecopyList.size() + " files to " - + destDir.getAbsolutePath()); + log("Copying " + filecopyList.size() + " file" + + (filecopyList.size() == 1 ? "" : "s") + + " to " + destDir.getAbsolutePath()); Enumeration enum = filecopyList.keys(); while (enum.hasMoreElements()) { String fromFile = (String) enum.nextElement(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index 2e35893f4..9e9f6757e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -136,7 +136,9 @@ public class Delete extends MatchingTask { String[] files = ds.getIncludedFiles(); if (files.length > 0) { - log("Deleting " + files.length + " files from " + delDir.getAbsolutePath()); + log("Deleting " + files.length + " file" + + (files.length == 1 ? "" : "s") + + " from " + delDir.getAbsolutePath()); for (int i = 0; i < files.length; i++) { File f = new File(delDir, files[i]); diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 1733427e7..b4efa2b99 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -84,9 +84,7 @@ import java.util.*; *
* When this task executes, it will recursively scan the sourcedir and * destdir looking for Java source files to compile. This task makes its - * compile decision based on timestamp. Any other file in the - * sourcedir will be copied to the destdir allowing support files to be - * located properly in the classpath. + * compile decision based on timestamp. * * @author James Davidson duncan@x180.com * @author Robin Green greenrd@hotmail.com @@ -325,7 +323,9 @@ public class Javac extends MatchingTask { if (compileList.size() > 0) { log("Compiling " + compileList.size() + - " source files to " + destDir); + " source file" + + (compileList.size() == 1 ? "" : "s") + + " to " + destDir); if (compiler.equalsIgnoreCase("classic")) { doClassicCompile(); @@ -372,11 +372,11 @@ public class Javac extends MatchingTask { if (!classFile.exists() || srcFile.lastModified() > classFile.lastModified()) { if (!classFile.exists()) { log("Compiling " + srcFile.getPath() + " because class file " - + classFile.getPath() + " does not exist", Project.MSG_VERBOSE); + + classFile.getPath() + " does not exist", Project.MSG_DEBUG); } else { log("Compiling " + srcFile.getPath() + " because it is out of date with respect to " - + classFile.getPath(), Project.MSG_VERBOSE); + + classFile.getPath(), Project.MSG_DEBUG); } compileList.addElement(srcFile.getAbsolutePath()); } @@ -567,7 +567,12 @@ public class Javac extends MatchingTask { log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE); - StringBuffer niceSourceList = new StringBuffer("Files to be compiled:"); + StringBuffer niceSourceList = new StringBuffer("File"); + if (compileList.size() != 1) { + niceSourceList.append("s"); + } + niceSourceList.append(" to be compiled:"); + niceSourceList.append(lSep); Enumeration enum = compileList.elements(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java index 3a2b9e103..38b3197fa 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java @@ -442,7 +442,9 @@ public class NetRexxC extends MatchingTask { // compile the source files if (compileList.size() > 0) { - log("Compiling " + compileList.size() + " source files to " + destDir); + log("Compiling " + compileList.size() + " source file" + + (compileList.size() == 1 ? "" : "s") + + " to " + destDir); doNetRexxCompile(); } } @@ -479,7 +481,9 @@ public class NetRexxC extends MatchingTask { */ private void copyFilesToDestination() { if (filecopyList.size() > 0) { - log("Copying " + filecopyList.size() + " files to " + destDir.getAbsolutePath()); + log("Copying " + filecopyList.size() + " file" + + (filecopyList.size() == 1 ? "" : "s") + + " to " + destDir.getAbsolutePath()); Enumeration enum = filecopyList.keys(); while (enum.hasMoreElements()) { String fromFile = (String)enum.nextElement();