Author: bodewig
Date: Thu Jul 16 11:49:08 2009
New Revision: 794639

URL: http://svn.apache.org/viewvc?rev=794639&view=rev
Log:
log stuff when actually creating the archive

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java?rev=794639&r1=794638&r2=794639&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ear.java Thu Jul 16 
11:49:08 2009
@@ -130,7 +130,7 @@
             if (deploymentDescriptor != null
                 || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file)
                 || descriptorAdded) {
-                logOnFirstPass("Warning: selected " + archiveType
+                logWhenWriting("Warning: selected " + archiveType
                                + " files include a " + XML_DESCRIPTOR_PATH
                                + " which will"
                                + " be ignored (please use appxml attribute to "

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java?rev=794639&r1=794638&r2=794639&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java Thu Jul 16 
11:49:08 2009
@@ -667,7 +667,7 @@
                 filesetManifest(fromArchive, is);
             }
         } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) {
-            logOnFirstPass("Warning: selected " + archiveType
+            logWhenWriting("Warning: selected " + archiveType
                            + " files include a " + INDEX_NAME + " which will"
                            + " be replaced by a newly generated one.",
                            Project.MSG_WARN);
@@ -704,7 +704,7 @@
         } else if (filesetManifestConfig != null
                     && !filesetManifestConfig.getValue().equals("skip")) {
             // we add this to our group of fileset manifests
-            logOnFirstPass("Found manifest to merge in file " + file,
+            logWhenWriting("Found manifest to merge in file " + file,
                            Project.MSG_VERBOSE);
 
             try {
@@ -939,7 +939,7 @@
             if (strict.getValue().equalsIgnoreCase("fail")) {
                 throw new BuildException(message.toString(), getLocation());
             } else {
-                logOnFirstPass(message.toString(), strict.getLogLevel());
+                logWhenWriting(message.toString(), strict.getLogLevel());
             }
         }
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java?rev=794639&r1=794638&r2=794639&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/War.java Thu Jul 16 
11:49:08 2009
@@ -188,7 +188,7 @@
                 addFile = false;
                 //check to see if we warn or not
                 if (!FILE_UTILS.fileNameEquals(addedWebXmlFile, file)) {
-                    logOnFirstPass("Warning: selected " + archiveType
+                    logWhenWriting("Warning: selected " + archiveType
                                    + " files include a second "
                                    + XML_DESCRIPTOR_PATH
                                    + " which will be ignored.\n"

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=794639&r1=794638&r2=794639&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Thu Jul 16 
11:49:08 2009
@@ -808,7 +808,7 @@
         // we don't need to update if the original file doesn't exist
         if (doUpdate && !zipFile.exists()) {
             doUpdate = false;
-            logOnFirstPass("ignoring update attribute as " + archiveType
+            logWhenWriting("ignoring update attribute as " + archiveType
                            + " doesn't exist.", Project.MSG_DEBUG);
         }
     }
@@ -818,14 +818,14 @@
         // Add the files found in groupfileset to fileset
         for (int i = 0; i < groupfilesets.size(); i++) {
 
-            logOnFirstPass("Processing groupfileset ", Project.MSG_VERBOSE);
+            logWhenWriting("Processing groupfileset ", Project.MSG_VERBOSE);
             FileSet fs = (FileSet) groupfilesets.elementAt(i);
             FileScanner scanner = fs.getDirectoryScanner(getProject());
             String[] files = scanner.getIncludedFiles();
             File basedir = scanner.getBasedir();
             for (int j = 0; j < files.length; j++) {
 
-                logOnFirstPass("Adding file " + files[j] + " to fileset",
+                logWhenWriting("Adding file " + files[j] + " to fileset",
                                Project.MSG_VERBOSE);
                 ZipFileSet zf = new ZipFileSet();
                 zf.setProject(getProject());
@@ -1287,11 +1287,11 @@
 
             if (emptyBehavior.equals("skip")) {
                 if (doUpdate) {
-                    logOnFirstPass(archiveType + " archive " + zipFile
+                    logWhenWriting(archiveType + " archive " + zipFile
                                    + " not updated because no new files were"
                                    + " included.", Project.MSG_VERBOSE);
                 } else {
-                    logOnFirstPass("Warning: skipping " + archiveType
+                    logWhenWriting("Warning: skipping " + archiveType
                                    + " archive " + zipFile
                                    + " because no files were included.",
                                    Project.MSG_WARN);
@@ -1628,7 +1628,7 @@
                           int mode, ZipExtraField[] extra)
         throws IOException {
         if (doFilesonly) {
-            logOnFirstPass("skipping directory " + vPath
+            logWhenWriting("skipping directory " + vPath
                            + " for file-only archive",
                            Project.MSG_VERBOSE);
             return;
@@ -1639,7 +1639,7 @@
             return;
         }
 
-        logOnFirstPass("adding directory " + vPath, Project.MSG_VERBOSE);
+        logWhenWriting("adding directory " + vPath, Project.MSG_VERBOSE);
         addedDirs.put(vPath, vPath);
 
         if (!skipWriting) {
@@ -1714,7 +1714,7 @@
         if (entries.contains(vPath)) {
 
             if (duplicate.equals("preserve")) {
-                logOnFirstPass(vPath + " already added, skipping",
+                logWhenWriting(vPath + " already added, skipping",
                                Project.MSG_INFO);
                 return;
             } else if (duplicate.equals("fail")) {
@@ -1723,11 +1723,11 @@
                                          + "attribute is 'fail'.");
             } else {
                 // duplicate equal to add, so we continue
-                logOnFirstPass("duplicate file " + vPath
+                logWhenWriting("duplicate file " + vPath
                                + " found, adding.", Project.MSG_VERBOSE);
             }
         } else {
-            logOnFirstPass("adding entry " + vPath, Project.MSG_VERBOSE);
+            logWhenWriting("adding entry " + vPath, Project.MSG_VERBOSE);
         }
 
         entries.put(vPath, vPath);
@@ -1945,7 +1945,7 @@
                                        if (!r.isDirectory()) {
                                            return true;
                                        } else if (doFilesonly) {
-                                           logOnFirstPass("Ignoring directory "
+                                           logWhenWriting("Ignoring directory "
                                                           + r.getName()
                                                           + " as only files 
will"
                                                           + " be added.",
@@ -1999,12 +1999,12 @@
 
     /**
      * Logs a message at the given output level, but only if this is
-     * the {...@link #isFirstPass first pass}.
+     * the pass that will actually create the archive.
      *
      * @since Ant 1.8.0
      */
-    protected void logOnFirstPass(String msg, int level) {
-        if (isFirstPass()) {
+    protected void logWhenWriting(String msg, int level) {
+        if (!skipWriting) {
             log(msg, level);
         }
     }


Reply via email to