ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Ellsworth <sc...@alodar.com>
Subject Re: Print message if property unset (or if file doesn't exist)?
Date Tue, 17 Sep 2002 16:16:44 GMT

On Monday, September 16, 2002, at 04:13  PM, Dominique Devienne wrote:

> Welcome back Diane ;-)
>
> Just a reminder, my hack to allow any Task-deriving task to have a 
> nested <condition> was of course never accepted.

Gotta say - having every task support if/unless, or a nested condition, 
would make a lot of tasks much easier.  Vis:

<target name="jar with manifest" if="jar.main-class">
   <jar>
     <fileset .../>
     <manifest>
        <attribute name="Main-Class" value="${jar.main-class}"/>
     </manifest>
   <jar>
</target>

<target name="jar without manifest" unless="jar.main-class">
   <jar>
     <fileset .../>
   <jar>
</target>

is more open to breakage and has more targets than one with if on every 
task:

<target name="jar">
   <jar  if="jar.main-class" >
     <fileset .../>
     <manifest>
        <attribute name="Main-Class" value="${jar.main-class}"/>
     </manifest>
   <jar>
   <jar  unless="jar.main-class" >
     <fileset .../>
   <jar>
</target>

Of course, the ideal would be

<jar>
   <fileset .../>
   <manifest>
      <attribute name="Main-Class" value="${jar.main-class}"/>
   </manifest>
<jar>

as we then do not end up with 2^n different targets or tasks within a 
target based on n different boolean options.
Scott


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


Mime
View raw message