Browse Source

jar filesetmanifest=merge only worked for an OS where filesep == /. PR 49090

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@933630 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
9969e4d608
3 changed files with 28 additions and 2 deletions
  1. +3
    -0
      WHATSNEW
  2. +11
    -2
      src/main/org/apache/tools/ant/taskdefs/Jar.java
  3. +14
    -0
      src/tests/antunit/taskdefs/jar-test.xml

+ 3
- 0
WHATSNEW View File

@@ -83,6 +83,9 @@ Fixed bugs:
references.
Bugzilla Reports 48961 and 49079

* <jar filesetmanifest="merge"> was broken on Windows.
Bugzilla Report 49090

Other changes:
--------------



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

@@ -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;
}


+ 14
- 0
src/tests/antunit/taskdefs/jar-test.xml View File

@@ -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>

Loading…
Cancel
Save