<!-- Compute the difference of the actual JAR and the expected zip entries -->
<resources id="artifact.set.discrepancies">
<difference>
<!-- Create a resource set from the actual archive -->
<zipfileset src="${path.to}/some_archive.jar" includes="**/*" />
<!-- Create a resource set of expected items -->
<resources>
<zipentry archive="${path.to}/some_archive.jar" name="afile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="anotherfile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="a/path/to/afile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="some/other/path/to/afile.ext"/>
<zipentry archive="${path.to}/some_archive.jar" name="META-INF/MANIFEST.MF"/>
</resources>
</difference>
</resources>
<pathconvert property="set.difference" refid="artifact.set.discrepancies" />
<condition property="artifacts.verified">
<resourcecount count="0" when="eq" refid="artifact.set.discrepancies" />
</condition>
<!-- Fail if any differences are found -->
<fail unless="artifacts.verified"
message="The following artifacts were not expected: ${set.difference}" />
Note: I believe a minimum version of Ant 1.7 is required for the resources stuff to work.
No comments:
Post a Comment