ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r933630 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/Jar.java src/tests/antunit/taskdefs/jar-test.xml
Date Tue, 13 Apr 2010 14:26:36 GMT
Author: bodewig
Date: Tue Apr 13 14:26:35 2010
New Revision: 933630

URL: http://svn.apache.org/viewvc?rev=933630&view=rev
Log:
jar filesetmanifest=merge only worked for an OS where filesep == /.  PR 49090

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
    ant/core/trunk/src/tests/antunit/taskdefs/jar-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=933630&r1=933629&r2=933630&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Apr 13 14:26:35 2010
@@ -83,6 +83,9 @@ Fixed bugs:
    references.
    Bugzilla Reports 48961 and 49079
 
+ * <jar filesetmanifest="merge"> was broken on Windows.
+   Bugzilla Report 49090
+
 Other changes:
 --------------
 

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=933630&r1=933629&r2=933630&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 Tue Apr 13 14:26:35 2010
@@ -813,7 +813,15 @@ public class Jar extends Zip {
             // manifest this means we claim an update was needed and
             // only include the manifests, skipping any uptodate
             // checks here defering them for the second run
-            return new ArchiveState(true, grabManifests(rcs));
+            Resource[][] manifests = grabManifests(rcs);
+            int count = 0;
+            for (int i = 0; i < manifests.length; i++) {
+                count += manifests[i].length;
+            }
+            log("found a total of " + count + " manifests in "
+                + manifests.length + " resource collections",
+                Project.MSG_VERBOSE);
+            return new ArchiveState(true, manifests);
         }
 
         // need to handle manifest as a special check
@@ -1167,7 +1175,8 @@ public class Jar extends Zip {
                     });
             }
             for (int j = 0; j < resources[0].length; j++) {
-                if (resources[0][j].getName().equalsIgnoreCase(MANIFEST_NAME)) {
+                String name = resources[0][j].getName().replace('\\', '/');
+                if (name.equalsIgnoreCase(MANIFEST_NAME)) {
                     manifests[i] = new Resource[] {resources[0][j]};
                     break;
                 }

Modified: ant/core/trunk/src/tests/antunit/taskdefs/jar-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/jar-test.xml?rev=933630&r1=933629&r2=933630&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/jar-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/jar-test.xml Tue Apr 13 14:26:35 2010
@@ -193,4 +193,18 @@
       </jar>
     </au:expectfailure>
   </target>
+
+  <target name="testFileSetMerge"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49090">
+    <mkdir dir="${input}/META-INF"/>
+    <mkdir dir="${output}"/>
+    <echo file="${input}/META-INF/MANIFEST.MF"><![CDATA[Test: Header
+]]></echo>
+    <jar destfile="${output}/test.jar" filesetmanifest="merge">
+      <fileset dir="${input}"/>
+    </jar>
+    <unjar src="${output}/test.jar" dest="${output}"/>
+    <au:assertResourceContains value="Test: Header"
+                               resource="${output}/META-INF/MANIFEST.MF"/>
+  </target>
 </project>



Mime
View raw message