ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Ficker <m.fic...@googlemail.com>
Subject Re: checksum task: how can you use hash in a separate directory
Date Wed, 13 Feb 2008 22:13:53 GMT
Hi,

pathconvert  can be used to perform "String manipulation" on filesets or
pathes.

The following would echo a linebreak seperated list of the files:

       (append after the  previous example)
        <pathconvert property ="result.prop" refid="result"
pathsep="${line.separator}">
            <globmapper from="${basedir}/checksums/*.MD5"
to="${basedir}/src/*"/>
        </pathconvert>
        <echo>${result.prop}</echo>

For further  manipulation as a fileset you could pathconvert to a comma
seperated list an stuff it back into a fileset.
For example to copy the changed files to backupDir:

        <pathconvert property="backup.prop" refid="result" pathsep=",">
            <globmapper from="${basedir}/checksums/*.MD5" to="*"/>
        </pathconvert>
               
        <copy todir="backupDir">
           <fileset dir="src" includes="${backup.prop}"/>
        </copy>

I don't know of o easier way to convert pathes into filesets.  

Best regards

Martin

Bill Milbratz schrieb:
> Hi all,
>
> Thanks for the resposnes. Martin, that's an elegant example and belongs in
> the ant documentation.
>
> As a follow up to Martin's example:
> once you have the list of 'result" files (which lists all the .md5 files
> which differ), how in ant can you generate a list of the *original* files.
>
> i.e. so you can send a message telling the user that he changed
> 'src/jsp/foo.jsp' and not just that 'checksums/jsp/foo.jsp.md5' doesn't
> match 'newchecksums/jsp/foo.jsp.md5'
> Or better yet, so that your ant target can "act on those changes", i.e. and
> backup src/jsp/foo.jsp before overwriting it....
>
> This may simply be an exercise in string manipulation with Ant or "advanced
> use of filesets",
>
> thanks,
>
> bill
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message