Browse Source

log stuff when actually creating the archive

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@794639 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
ffe7ce3c54
4 changed files with 19 additions and 19 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Ear.java
  2. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/War.java
  4. +14
    -14
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Ear.java View File

@@ -130,7 +130,7 @@ public class Ear extends Jar {
if (deploymentDescriptor != null if (deploymentDescriptor != null
|| !FILE_UTILS.fileNameEquals(deploymentDescriptor, file) || !FILE_UTILS.fileNameEquals(deploymentDescriptor, file)
|| descriptorAdded) { || descriptorAdded) {
logOnFirstPass("Warning: selected " + archiveType
logWhenWriting("Warning: selected " + archiveType
+ " files include a " + XML_DESCRIPTOR_PATH + " files include a " + XML_DESCRIPTOR_PATH
+ " which will" + " which will"
+ " be ignored (please use appxml attribute to " + " be ignored (please use appxml attribute to "


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Jar.java View File

@@ -667,7 +667,7 @@ public class Jar extends Zip {
filesetManifest(fromArchive, is); filesetManifest(fromArchive, is);
} }
} else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) {
logOnFirstPass("Warning: selected " + archiveType
logWhenWriting("Warning: selected " + archiveType
+ " files include a " + INDEX_NAME + " which will" + " files include a " + INDEX_NAME + " which will"
+ " be replaced by a newly generated one.", + " be replaced by a newly generated one.",
Project.MSG_WARN); Project.MSG_WARN);
@@ -704,7 +704,7 @@ public class Jar extends Zip {
} else if (filesetManifestConfig != null } else if (filesetManifestConfig != null
&& !filesetManifestConfig.getValue().equals("skip")) { && !filesetManifestConfig.getValue().equals("skip")) {
// we add this to our group of fileset manifests // 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); Project.MSG_VERBOSE);


try { try {
@@ -939,7 +939,7 @@ public class Jar extends Zip {
if (strict.getValue().equalsIgnoreCase("fail")) { if (strict.getValue().equalsIgnoreCase("fail")) {
throw new BuildException(message.toString(), getLocation()); throw new BuildException(message.toString(), getLocation());
} else { } else {
logOnFirstPass(message.toString(), strict.getLogLevel());
logWhenWriting(message.toString(), strict.getLogLevel());
} }
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/War.java View File

@@ -188,7 +188,7 @@ public class War extends Jar {
addFile = false; addFile = false;
//check to see if we warn or not //check to see if we warn or not
if (!FILE_UTILS.fileNameEquals(addedWebXmlFile, file)) { if (!FILE_UTILS.fileNameEquals(addedWebXmlFile, file)) {
logOnFirstPass("Warning: selected " + archiveType
logWhenWriting("Warning: selected " + archiveType
+ " files include a second " + " files include a second "
+ XML_DESCRIPTOR_PATH + XML_DESCRIPTOR_PATH
+ " which will be ignored.\n" + " which will be ignored.\n"


+ 14
- 14
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -808,7 +808,7 @@ public class Zip extends MatchingTask {
// we don't need to update if the original file doesn't exist // we don't need to update if the original file doesn't exist
if (doUpdate && !zipFile.exists()) { if (doUpdate && !zipFile.exists()) {
doUpdate = false; doUpdate = false;
logOnFirstPass("ignoring update attribute as " + archiveType
logWhenWriting("ignoring update attribute as " + archiveType
+ " doesn't exist.", Project.MSG_DEBUG); + " doesn't exist.", Project.MSG_DEBUG);
} }
} }
@@ -818,14 +818,14 @@ public class Zip extends MatchingTask {
// Add the files found in groupfileset to fileset // Add the files found in groupfileset to fileset
for (int i = 0; i < groupfilesets.size(); i++) { 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); FileSet fs = (FileSet) groupfilesets.elementAt(i);
FileScanner scanner = fs.getDirectoryScanner(getProject()); FileScanner scanner = fs.getDirectoryScanner(getProject());
String[] files = scanner.getIncludedFiles(); String[] files = scanner.getIncludedFiles();
File basedir = scanner.getBasedir(); File basedir = scanner.getBasedir();
for (int j = 0; j < files.length; j++) { 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); Project.MSG_VERBOSE);
ZipFileSet zf = new ZipFileSet(); ZipFileSet zf = new ZipFileSet();
zf.setProject(getProject()); zf.setProject(getProject());
@@ -1287,11 +1287,11 @@ public class Zip extends MatchingTask {


if (emptyBehavior.equals("skip")) { if (emptyBehavior.equals("skip")) {
if (doUpdate) { if (doUpdate) {
logOnFirstPass(archiveType + " archive " + zipFile
logWhenWriting(archiveType + " archive " + zipFile
+ " not updated because no new files were" + " not updated because no new files were"
+ " included.", Project.MSG_VERBOSE); + " included.", Project.MSG_VERBOSE);
} else { } else {
logOnFirstPass("Warning: skipping " + archiveType
logWhenWriting("Warning: skipping " + archiveType
+ " archive " + zipFile + " archive " + zipFile
+ " because no files were included.", + " because no files were included.",
Project.MSG_WARN); Project.MSG_WARN);
@@ -1628,7 +1628,7 @@ public class Zip extends MatchingTask {
int mode, ZipExtraField[] extra) int mode, ZipExtraField[] extra)
throws IOException { throws IOException {
if (doFilesonly) { if (doFilesonly) {
logOnFirstPass("skipping directory " + vPath
logWhenWriting("skipping directory " + vPath
+ " for file-only archive", + " for file-only archive",
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
return; return;
@@ -1639,7 +1639,7 @@ public class Zip extends MatchingTask {
return; return;
} }


logOnFirstPass("adding directory " + vPath, Project.MSG_VERBOSE);
logWhenWriting("adding directory " + vPath, Project.MSG_VERBOSE);
addedDirs.put(vPath, vPath); addedDirs.put(vPath, vPath);


if (!skipWriting) { if (!skipWriting) {
@@ -1714,7 +1714,7 @@ public class Zip extends MatchingTask {
if (entries.contains(vPath)) { if (entries.contains(vPath)) {


if (duplicate.equals("preserve")) { if (duplicate.equals("preserve")) {
logOnFirstPass(vPath + " already added, skipping",
logWhenWriting(vPath + " already added, skipping",
Project.MSG_INFO); Project.MSG_INFO);
return; return;
} else if (duplicate.equals("fail")) { } else if (duplicate.equals("fail")) {
@@ -1723,11 +1723,11 @@ public class Zip extends MatchingTask {
+ "attribute is 'fail'."); + "attribute is 'fail'.");
} else { } else {
// duplicate equal to add, so we continue // duplicate equal to add, so we continue
logOnFirstPass("duplicate file " + vPath
logWhenWriting("duplicate file " + vPath
+ " found, adding.", Project.MSG_VERBOSE); + " found, adding.", Project.MSG_VERBOSE);
} }
} else { } else {
logOnFirstPass("adding entry " + vPath, Project.MSG_VERBOSE);
logWhenWriting("adding entry " + vPath, Project.MSG_VERBOSE);
} }


entries.put(vPath, vPath); entries.put(vPath, vPath);
@@ -1945,7 +1945,7 @@ public class Zip extends MatchingTask {
if (!r.isDirectory()) { if (!r.isDirectory()) {
return true; return true;
} else if (doFilesonly) { } else if (doFilesonly) {
logOnFirstPass("Ignoring directory "
logWhenWriting("Ignoring directory "
+ r.getName() + r.getName()
+ " as only files will" + " as only files will"
+ " be added.", + " be added.",
@@ -1999,12 +1999,12 @@ public class Zip extends MatchingTask {


/** /**
* Logs a message at the given output level, but only if this is * 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 * @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); log(msg, level);
} }
} }


Loading…
Cancel
Save