ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: running a target only when dependset indicates to
Date Tue, 20 Apr 2004 09:13:08 GMT
That´s the common check-before-execution-behaviour.

<target name="check">
    <uptodate property="mustdo" .../>
</>
<target name="mywork" if="mustdo" depends="check"/>


Jan


> -----Original Message-----
> From: Eliot Stock [mailto:E.Stock@syzygy.net]
> Sent: Tuesday, April 20, 2004 11:12 AM
> To: 'user@ant.apache.org'
> Subject: running a target only when dependset indicates to
> 
> 
> Hello.
> 
> I have a target called 'bind' in my build which uses xjc 
> (JAXB .xsd -> .java
> compiler) to compile XML schema files into Java sources. 
> Currently, 'bind'
> runs on every run of any target that depends on it - ant 
> doesn't know when
> the target is up to date. I want it to run only when the 
> source xsd files
> are newer than the generated .java files.
> 
> At first, the dependset tag looked promising, but I now 
> realise that adding
> a dependset will have ant run the target when the dependset 
> indicates it
> should *in addition* to the other times it's running (which 
> is always). What
> I want is a dependset that has its enclosing target run *only* when it
> indicates.
> 
> Is this possible?
> 
> Cheers,
> 
> Eliot Stock
> syzygy.net
> +44 20 7598 9910
> 
>   <target name="bind" depends="init">
> 
>     <!-- Only re-run this target when the xsd files are more 
> recent than the
>          generated sources (this is NOT the effect this 
> dependset has) -->
>     <dependset>
>        <srcfilelist dir="schema" files="*.xsd" />
>        <srcfilelist dir="schema" files="binding.xjb" />
>        <targetfileset dir="gen-src" includes = "**/*.java" />
>     </dependset>
> 
>     <echo message="Compiling non-generated sources required 
> for binding..."
> />
>     <javac destdir="classes" srcdir="src" debug="on">
>       <include
> name="uk/co/airmiles/web/ypsilon/YpsilonJAXBCalendarConverter.java" />
>       <classpath refid="classpath" />
>     </javac>
> 
>     <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
>       <classpath refid="classpath" />
>     </taskdef>
> 
>     <echo message="Generating Java sources from XSD schema 
> files..." />
>     <xjc target="gen-src"
>          package="uk.co.airmiles.web.ypsilon"
>          binding="schema/binding.xjb">
>       <schema file="schema/errorResponse.xsd" />
>       <schema file="schema/fareRequest.xsd" />
>       <schema file="schema/availRequest.xsd" />
>       <schema file="schema/combined.xsd" />
>       <schema file="schema/bookingRequest.xsd" />
>     </xjc>
> 
>     <echo message="Generating Javadoc from generated sources..." />
>     <mkdir dir="docs/api" />
>     <javadoc packagenames="uk.co.airmiles.web.ypsilon"
>              sourcepath="gen-src"
>              destdir="docs/api"
>              windowtitle="Generated Interfaces for Ypsilon">
>       <classpath refid="classpath" />
>     </javadoc>
>   </target>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message