antoine 2005/04/18 13:26:08
Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Zip.java
src/testcases/org/apache/tools/ant/taskdefs Tag:
ANT_16_BRANCH ZipTest.java JarTest.java
. Tag: ANT_16_BRANCH WHATSNEW
Log:
Merge
make Zip and derivates call createEmptyZip when creating empty archives
Revision Changes Path
No revision
No revision
1.116.2.17 +22 -0 ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.116.2.16
retrieving revision 1.116.2.17
diff -u -r1.116.2.16 -r1.116.2.17
--- Zip.java 11 Mar 2005 08:48:20 -0000 1.116.2.16
+++ Zip.java 18 Apr 2005 20:26:08 -0000 1.116.2.17
@@ -429,6 +429,10 @@
return;
}
+ if (!zipFile.exists() && state.isWithoutAnyResources()) {
+ createEmptyZip(zipFile);
+ return;
+ }
Resource[][] addThem = state.getResourcesToAdd();
if (doUpdate) {
@@ -1305,5 +1309,23 @@
public Resource[][] getResourcesToAdd() {
return resourcesToAdd;
}
+ /**
+ * find out if there are absolutely no resources to add
+ * @since Ant 1.6.3
+ * @return true if there are no resources to add
+ */
+ public boolean isWithoutAnyResources() {
+ if (resourcesToAdd == null) {
+ return true;
+ }
+ for (int counter = 0; counter < resourcesToAdd.length;
counter++) {
+ if (resourcesToAdd[counter] != null) {
+ if (resourcesToAdd[counter].length > 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
}
}
No revision
No revision
1.15.2.7 +1 -1
ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java
Index: ZipTest.java
===================================================================
RCS file:
/home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java,v
retrieving revision 1.15.2.6
retrieving revision 1.15.2.7
diff -u -r1.15.2.6 -r1.15.2.7
--- ZipTest.java 27 Dec 2004 11:33:20 -0000 1.15.2.6
+++ ZipTest.java 18 Apr 2005 20:26:08 -0000 1.15.2.7
@@ -140,7 +140,7 @@
getProject().resolveFile("test3.zip").exists());
}
public void testZipEmptyCreate() {
- executeTarget("zipEmptyCreate");
+ expectLogContaining("zipEmptyCreate", "Note: creating empty");
assertTrue("archive should be created",
getProject().resolveFile("test3.zip").exists());
1.22.2.8 +1 -1
ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java
Index: JarTest.java
===================================================================
RCS file:
/home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/JarTest.java,v
retrieving revision 1.22.2.7
retrieving revision 1.22.2.8
diff -u -r1.22.2.7 -r1.22.2.8
--- JarTest.java 27 Dec 2004 11:33:20 -0000 1.22.2.7
+++ JarTest.java 18 Apr 2005 20:26:08 -0000 1.22.2.8
@@ -258,7 +258,7 @@
}
}
public void testManifestOnlyJar() {
- executeTarget("testManifestOnlyJar");
+ expectLogContaining("testManifestOnlyJar", "Building MANIFEST-only
jar: ");
File manifestFile = getProject().resolveFile(tempDir + "META-INF" +
File.separator + "MANIFEST.MF");
assertTrue(manifestFile.exists());
}
No revision
No revision
1.503.2.216 +4 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.503.2.215
retrieving revision 1.503.2.216
diff -u -r1.503.2.215 -r1.503.2.216
--- WHATSNEW 15 Apr 2005 20:52:52 -0000 1.503.2.215
+++ WHATSNEW 18 Apr 2005 20:26:08 -0000 1.503.2.216
@@ -16,6 +16,10 @@
return any, causing problems with Informix IDS 9.2 and IBM DB2 8.1
FixPak 6 (or later). Bugzilla Reports 27162 and 29954.
+* make sure that Zip and its derivates call the createEmptyZip method when
+ there are no resources to zip/jar/...
+
+
Changes from Ant 1.6.2 to Ant 1.6.3beta1
========================================
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]