ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <jesse.gl...@sun.com>
Subject Re: conditional attributes for arg and env elements
Date Wed, 26 Jul 2006 21:00:42 GMT
Matt Benson wrote:
>> Would it be possible to add if and unless attributes to the env and
>> arg elements used in exec [...]
> 
> if it is "defined vs. not defined" you could use conditionally
> defined presetdefs.

That is a lot more cumbersome however.

<target name="x">
   <exec ...>
     <arg value="-opt" if="opt"/>
   </exec>
</target>

vs. (ack!)

<target name="x" depends="x-predef-with-opt,x-predef-without-opt">
   <x-exec .../>
</target>
<target name="x-predef-with-opt">
   <presetdef name="x-exec">
     <exec>
       <arg value="-opt"/>
     </exec>
   </presetdef>
</target>
<target name="x-predef-without-opt">
   <presetdef name="x-exec">
     <exec/>
   </presetdef>
</target>

Also the number of extra ugly targets you have to write is exponential 
in the number of distinct properties you would like to have 
conditionally affect the form of the task.

-J.

-- 
jesse.glick@sun.com  x22801  netbeans.org  ant.apache.org
       http://google.com/search?q=e%5E%28pi*i%29%2B1


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


Mime
View raw message