Reputation: 11
Using ANT, I'm trying to create a zip file for my build for an update to a released version. To get the list of changed files (this includes .jar files with version strings embedded in the file name), I've done the following:
I now want to create a fileset that contains the changed files from step 3, but with the full file names from the original updated set. So the fileset I seek would find that foo.jar has changed, and include "foo_1.0.1.jar".
However, I'm struggling to figure out how to match the diff'ed fileset up with the real file set including version numbers. How would one do this in ANT?
Upvotes: 1
Views: 101
Reputation: 11
And I found how to do this, (as Mark pointed out) somewhat complicated issue. My issue was not using the right base for creating the file set. To do so, I did the following.
"update.offering" = Location of the updated code "${temp.dir}/diffFiles" = Location I copied the files found to have changed from the base version, minus version strings in the file name
<copy todir="${temp.dir}/outFiles" includeemptydirs="false">
<fileset dir="${update.offering}" id="final.set">
<present present="both" targetdir="${temp.dir}/diffFiles">
<firstmatchmapper>
<regexpmapper from="(.*)(_[0-9]\..*)(\..*)" to="\1\3"/>
<mapper type="glob" from="*.*" to="*.*"/>
<mapper type="glob" from="*" to="*"/>
</firstmatchmapper>
</present>
</fileset>
</copy>
What I needed to do was use the location of the updated files as the basis for the new fileset, then match the files in the target directory using a regular expression mapper that allowed me to match the file name excluding the version string. I've also included two glob mappers to make sure I got files without a version string in the name that were different.
Upvotes: 0