ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Depend task 0 deletion does stop target execution
Date Fri, 08 Nov 2002 23:01:26 GMT
You mean <dependset>, right? Anyhow, to conditionally execute tasks, you
first have to find out if the generation process needs to happen, and then
make it happen if needed.

The first step is done using either <available> or <dependset>. The latter
is more generic, but doesn't set a property when doing something (deleting
the targets when it found they are out-of-date vs. the sources). The former
set the property you need, but supports only 1 to 1 (using a mapper) or
many-to-1 relationship, and doesn't delete the out-of-date target files. If
you go for <dependset>, you need an additional <available> usually to find
out a-posteriori if it did something. If you do with <available>, you may
need to delete the target files (depends on your generation process).

The second step is done in a separate target executed conditionally based on
the target than check whether the target files are up-to-date or not, which
sets a property accordingly.

All this needs to be wrap in yet another target that depends on the two
previous one.

<target name="gen"
        depends="gen-needed?, do-gen" />

<target name="gen-needed?">
  <!-- set property gen-targetfiles-up2date only when target files
       are really up-todate. Do nothing if they're not.
  <property name="gen-targetfiles-up2date" value="whatever" />

<target name="do-gen"
  <xdoclet ... />

I hope this helps. --DD

-----Original Message-----
From: Sebastien BLANC [] 
Sent: Friday, November 08, 2002 3:57 PM
Subject: Depend task 0 deletion does stop target execution

Hello !
I'd like to know if there is a way to perform the following with ant
(haven't found anything in doc): I have tasks in my project generating
code and meta-data (xdoclet for instance) and I'd like these files not
to be regenerated if they were already generated before [and if the
source files for the generation were not modified (as javac does)].
The  'Depend' task does not resolve the pb since it's only removing the
generated files if time stamp between sources and generation verifies a
given order.
What I would have expected is that ant would stop the execution of the
target if the depend task nested into my target did not detect any file
to remove: this way the files would not be regenerated twice.
Let me know if I did miss smthg.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message