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>

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

I hope this helps. --DD

-----Original Message-----
From: Sebastien BLANC [mailto:Sebastien.Blanc@;alcatel.com] 
Sent: Friday, November 08, 2002 3:57 PM
To: [EMAIL PROTECTED]
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.
thanx.
seb.


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

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

Reply via email to