git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268025 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -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"); | |||
| } | |||
| } | |||
| @@ -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"; | |||
| } | |||
| } | |||
| } | |||
| @@ -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(); | |||
| @@ -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]); | |||
| @@ -84,9 +84,7 @@ import java.util.*; | |||
| * <p> | |||
| * 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 <a href="mailto:duncan@x180.com">duncan@x180.com</a> | |||
| * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | |||
| @@ -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(); | |||
| @@ -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(); | |||