ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rainer Noack" <rai...@noacks.net>
Subject RE: Creating new JARs based on property change
Date Wed, 16 Mar 2005 21:55:43 GMT
Holger,

I'm not really sure what you mean.
Either you have one "boolean" property that tells you cfg has changed or not
Or you have two properties with last and current cfg.

In both cases you can use a combination of <condition> task and target's
<if> attribute:


Example for the second (more complex) case:

<target name="loadprop">
  <property name="cfg" location="..."/>
  <property file="lastcfg.properties" prefix="old"/>
  <condition property="cfg.changed">
    <not><equals arg1="${cfg}" arg2="${old.cfg}"/></not>
  </condition>
</target>

<target name="removejar" depends="loadprop" if="cfg.changed">
  <delete file="my.jar"/>
  <echo file="lastcfg.properties">${cfg}
  </echo>
</target>

<import file="${cfg}"/>

Make sure to have "removejar" in your depends chain.

Instead of the additional target you can also use ant-contrib's <if> task.

Cheers

Rainer

> -----Original Message-----
> From: Holger Rauch [mailto:holger.rauch@heitec.de] 
> Sent: Wednesday, March 16, 2005 5:52 PM
> To: Ant Users List; rainer@noacks.net
> Subject: Re: Creating new JARs based on property change
> 
> 
> On Wed, 16 Mar 2005, Rainer Noack wrote:
> 
> > Remove the existing jar.
> 
> Sure, but I only want to remove the existing JAR if the 
> property indicating whether the JAR is supposed to be signed 
> has changed since otherwise I end up rebuilding the JAR file 
> even though it wasn't necessary. This property is set in a 
> build file that's loaded via <property name="cfg" 
> location="..."> and then <import file="${cfg}" />. What's the 
> proper way to determine a property change in such a case?
> 
> TIA.
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message