ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Overriding ant <copy> task
Date Mon, 05 Jul 2010 05:39:16 GMT
Seems like a lot of work. Why not do the <copy> task with the filter,
then use a mechanism to test the copied files to see if any tokens
exist. You can use the <concat> command with the <containsregex>
filter to see if any tokens (Pattern = /@\w+@/) exists in the files
just copied.

If you do find such files exist, you can fail the build.

On Sun, Jul 4, 2010 at 7:17 PM, Sony Antony <sony.antony@gmail.com> wrote:
> Hi :
> Im trying to modify the <copy> task so that if a token seen in the
> file being copied, is undefined in teh <filterset>, the build will
> fail..
> ( It will also list all teh undefined tokens encountered against the
> corresponding file name )
>
> 1. Was there an way to do this without writing java code ?
>
> 2. I have already made the changes required in teh ant source code.
> But I cant figure out how to execute my code.
> I created a jar file with just the changed class files, and did a
> <taskdef> with this jar file.
> But none of my files got executed.
> Since my class files were packaged just like teh original ant
> classfiles, it appeard that ant ignored them completely thinking that
> those class files have already been loaded.
>
> Is there a way around it so that class files seen inside my jar file
> will be picked up first and the remaining files will be resolved from
> the original ant classloader
>
> Thanks
> --sony
>
> Files being changed and packaged inside antfix.jar
> apache-ant-1.8.1/src/main/org/apache/tools/ant/taskdefs/Copy.java
> apache-ant-1.8.1/src/main/org/apache/tools/ant/types/FilterSet.java
> apache-ant-1.8.1/src/main/org/apache/tools/ant/types/FilterSetCollection.java
> apache-ant-1.8.1/src/main/org/apache/tools/ant/util/ResourceUtils.java
>
> <taskdef name="copy2" classname="org.apache.tools.ant.taskdefs.Copy"
> classpath="/path/to/antfix.jar"/>
>
> Doesnt work :
> <target name="try">
>        <copy2 file="srcfile" toFile="destfile">
> <filterset begintoken="@" endtoken="#">
> <filter token="TOK1" value="VAL1"/>
> <filter token="TOK2" value="VAL2"/>
> </filterset>
>        </copy2>
>        </target>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
David Weintraub
qazwart@gmail.com

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


Mime
View raw message