You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Alan Moss <am...@learningsoft.net> on 2005/09/26 18:51:07 UTC

Apply task argument issues...

I have an issue WRT the apply task. I need it to be much more flexible
than the documentation states it is. Let's say I'm using a tool that has
odd command line options like this:

    util.exe [options] +|-<filename>

    where options is optional and you must specify +<filename>
    or -<filename>

Given the current way in which the apply task is implemented, it seems
impossible to do in ant 1.6.5:

    <apply executable="util.exe" parallel="false">
       <arg value="+"/>
       <srcfile/>
       <fileset dir="files/"/>
    </apply>

Wouldn't it make more sense to do the following:

    <apply executable="util.exe" parallel="false" srcproperty="srcfile">
       <arg value="+${srcfile}"/>
       <fileset dir="files/"/>
    </apply>

I can't understand why it was implemented as separate tags rather than
as properties. In my opinion, the latter example would be more in-step
with typical ANT thinking.

Anyway, does anyone know of a way to do what I want with the current
version of ant?

Thanks,
-Alan

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


Re: Apply task argument issues...

Posted by Matt Benson <gu...@yahoo.com>.
--- Nicolas Vervelle <ni...@steria.com>
wrote:
[SNIP]
> - try a <mapper> to add a "+" before your filename,
> set addsourcefile to 
> false, and use <targetfile/>

I would expect this to work; however by faking the
target filename incremental builds won't work.  At
present it might be best to subclass apply to achieve
this.

Dev:  We should probably add either a nested mapper or
prepend/append attributes to srcfile and targetfile
elements in apply for future versions of Ant.

-Matt
> 
> Hope this helps,
> Nicolas
> 
> Alan Moss wrote:
> 
> >I have an issue WRT the apply task. I need it to be
> much more flexible
> >than the documentation states it is. Let's say I'm
> using a tool that has
> >odd command line options like this:
> >
> >    util.exe [options] +|-<filename>
> >
> >    where options is optional and you must specify
> +<filename>
> >    or -<filename>
> >
> >Given the current way in which the apply task is
> implemented, it seems
> >impossible to do in ant 1.6.5:
> >
> >    <apply executable="util.exe" parallel="false">
> >       <arg value="+"/>
> >       <srcfile/>
> >       <fileset dir="files/"/>
> >    </apply>
> >
> >Wouldn't it make more sense to do the following:
> >
> >    <apply executable="util.exe" parallel="false"
> srcproperty="srcfile">
> >       <arg value="+${srcfile}"/>
> >       <fileset dir="files/"/>
> >    </apply>
> >
> >I can't understand why it was implemented as
> separate tags rather than
> >as properties. In my opinion, the latter example
> would be more in-step
> >with typical ANT thinking.
> >
> >Anyway, does anyone know of a way to do what I want
> with the current
> >version of ant?
> >
> >Thanks,
> >-Alan
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> >For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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


Re: Apply task argument issues...

Posted by Matt Benson <gu...@yahoo.com>.
--- Nicolas Vervelle <ni...@steria.com>
wrote:
[SNIP]
> - try a <mapper> to add a "+" before your filename,
> set addsourcefile to 
> false, and use <targetfile/>

I would expect this to work; however by faking the
target filename incremental builds won't work.  At
present it might be best to subclass apply to achieve
this.

Dev:  We should probably add either a nested mapper or
prepend/append attributes to srcfile and targetfile
elements in apply for future versions of Ant.

-Matt
> 
> Hope this helps,
> Nicolas
> 
> Alan Moss wrote:
> 
> >I have an issue WRT the apply task. I need it to be
> much more flexible
> >than the documentation states it is. Let's say I'm
> using a tool that has
> >odd command line options like this:
> >
> >    util.exe [options] +|-<filename>
> >
> >    where options is optional and you must specify
> +<filename>
> >    or -<filename>
> >
> >Given the current way in which the apply task is
> implemented, it seems
> >impossible to do in ant 1.6.5:
> >
> >    <apply executable="util.exe" parallel="false">
> >       <arg value="+"/>
> >       <srcfile/>
> >       <fileset dir="files/"/>
> >    </apply>
> >
> >Wouldn't it make more sense to do the following:
> >
> >    <apply executable="util.exe" parallel="false"
> srcproperty="srcfile">
> >       <arg value="+${srcfile}"/>
> >       <fileset dir="files/"/>
> >    </apply>
> >
> >I can't understand why it was implemented as
> separate tags rather than
> >as properties. In my opinion, the latter example
> would be more in-step
> >with typical ANT thinking.
> >
> >Anyway, does anyone know of a way to do what I want
> with the current
> >version of ant?
> >
> >Thanks,
> >-Alan
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> >For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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


Re: Apply task argument issues...

Posted by Nicolas Vervelle <ni...@steria.com>.
Hi,

A few ideas (not tested, just ideas) :
- use a <for> task for iterating through the fileset.
- try a <mapper> to add a "+" before your filename, set addsourcefile to 
false, and use <targetfile/>

Hope this helps,
Nicolas

Alan Moss wrote:

>I have an issue WRT the apply task. I need it to be much more flexible
>than the documentation states it is. Let's say I'm using a tool that has
>odd command line options like this:
>
>    util.exe [options] +|-<filename>
>
>    where options is optional and you must specify +<filename>
>    or -<filename>
>
>Given the current way in which the apply task is implemented, it seems
>impossible to do in ant 1.6.5:
>
>    <apply executable="util.exe" parallel="false">
>       <arg value="+"/>
>       <srcfile/>
>       <fileset dir="files/"/>
>    </apply>
>
>Wouldn't it make more sense to do the following:
>
>    <apply executable="util.exe" parallel="false" srcproperty="srcfile">
>       <arg value="+${srcfile}"/>
>       <fileset dir="files/"/>
>    </apply>
>
>I can't understand why it was implemented as separate tags rather than
>as properties. In my opinion, the latter example would be more in-step
>with typical ANT thinking.
>
>Anyway, does anyone know of a way to do what I want with the current
>version of ant?
>
>Thanks,
>-Alan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>  
>


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


Re: Apply task argument issues...

Posted by Alan Moss <am...@learningsoft.net>.
Oh yeah, the reason the current ANT way of executing this causes a space
to be inserted in-between the + and the filename. This, in turn, causes
util.exe to fail.

>     <apply executable="util.exe" parallel="false">
>        <arg value="+"/>
>        <srcfile/>
>        <fileset dir="files/"/>
>     </apply>

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