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
|| !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 "


+ 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);
}
} 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 @@ public class Jar extends Zip {
} 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 @@ public class Jar extends Zip {
if (strict.getValue().equalsIgnoreCase("fail")) {
throw new BuildException(message.toString(), getLocation());
} 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;
//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"


+ 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
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 @@ public class Zip extends MatchingTask {
// 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 @@ public class Zip extends MatchingTask {

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 @@ public class Zip extends MatchingTask {
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 @@ public class Zip extends MatchingTask {
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 @@ public class Zip extends MatchingTask {
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 @@ public class Zip extends MatchingTask {
+ "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 @@ public class Zip extends MatchingTask {
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 @@ public class Zip extends MatchingTask {

/**
* 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);
}
}


Loading…
Cancel
Save