PR: 32802 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277264 13f79535-47bb-0310-9956-ffa450edef68master
@@ -176,6 +176,8 @@ Fixed bugs: | |||||
* Zip task was not zipping when only empty directories were found. Bugzilla 30365. | * Zip task was not zipping when only empty directories were found. Bugzilla 30365. | ||||
* Jar task was not including manifest files when duplicate="preserve" was chosen. Bugzilla 32802. | |||||
* Classpath was treated in the same way as -lib options. Bugzilla 28046. | * Classpath was treated in the same way as -lib options. Bugzilla 28046. | ||||
* Manual page for cvsversion contained incorrect attributes and did not say since 1.6.1. | * Manual page for cvsversion contained incorrect attributes and did not say since 1.6.1. | ||||
@@ -209,5 +209,17 @@ | |||||
<mkdir dir="${tmp.dir}/sub"/> | <mkdir dir="${tmp.dir}/sub"/> | ||||
<touch file="${tmp.dir}/sub/foo"/> | <touch file="${tmp.dir}/sub/foo"/> | ||||
<jar destfile="${tmp.jar}" index="yes" basedir="${tmp.dir}"/> | <jar destfile="${tmp.jar}" index="yes" basedir="${tmp.dir}"/> | ||||
</target> | |||||
<!-- bug 32802 --> | |||||
<target name="testManifestOnlyJar"> | |||||
<mkdir dir="${tmp.dir}"/> | |||||
<jar destfile="${tmp.jar}" duplicate="preserve"> | |||||
<manifest> | |||||
<attribute name="Foo" value="bar"/> | |||||
</manifest> | |||||
</jar> | |||||
<mkdir dir="${tmp.dir}"/> | |||||
<unzip src="${tmp.jar}" dest="${tmp.dir}"/> | |||||
</target> | </target> | ||||
</project> | </project> |
@@ -134,6 +134,11 @@ | |||||
<zip destfile="test3.zip" basedir="empty" update="true"/> | <zip destfile="test3.zip" basedir="empty" update="true"/> | ||||
</target> | </target> | ||||
<target name="zipEmptyCreate"> | |||||
<mkdir dir="empty"/> | |||||
<zip destfile="test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/> | |||||
</target> | |||||
<target name="cleanup"> | <target name="cleanup"> | ||||
<delete file="test3.zip"/> | <delete file="test3.zip"/> | ||||
<delete file="test4.zip"/> | <delete file="test4.zip"/> | ||||
@@ -800,7 +800,9 @@ public class Zip extends MatchingTask { | |||||
getLocation()); | getLocation()); | ||||
} else { | } else { | ||||
// Create. | // Create. | ||||
createEmptyZip(zipFile); | |||||
if (!zipFile.exists()) { | |||||
needsUpdate = true; | |||||
} | |||||
} | } | ||||
return new ArchiveState(needsUpdate, initialResources); | return new ArchiveState(needsUpdate, initialResources); | ||||
} | } | ||||
@@ -256,4 +256,9 @@ public class JarTest extends BuildFileTest { | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public void testManifestOnlyJar() { | |||||
executeTarget("testManifestOnlyJar"); | |||||
File manifestFile = getProject().resolveFile(tempDir + "META-INF" + File.separator + "MANIFEST.MF"); | |||||
assertTrue(manifestFile.exists()); | |||||
} | |||||
} | } |
@@ -139,4 +139,10 @@ public class ZipTest extends BuildFileTest { | |||||
assertTrue("archive should be created", | assertTrue("archive should be created", | ||||
getProject().resolveFile("test3.zip").exists()); | getProject().resolveFile("test3.zip").exists()); | ||||
} | } | ||||
public void testZipEmptyCreate() { | |||||
executeTarget("zipEmptyCreate"); | |||||
assertTrue("archive should be created", | |||||
getProject().resolveFile("test3.zip").exists()); | |||||
} | |||||
} | } |