ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: AW: Conditional target execution based on prerequisite execut ion
Date Tue, 18 Feb 2003 16:07:45 GMT
Is <uptodate> your solution?


Jan Matèrne



-----Ursprüngliche Nachricht-----
Von: Timothy Wall [mailto:twall@oculustech.com]
Gesendet am: Dienstag, 18. Februar 2003 17:02
An: Ant Users List
Betreff: Re: AW: Conditional target execution based on prerequisite
execution

The goal is not "run A before B" (although that may be a requirement).  
The goal is "only run B if it is out of date".  Ant by default runs 
(almost) everything all the time.

If B takes nonzero time to run, I *only* want it to run if B is "out of 
date".  Normally, a target would be considered out of date if
a) any of its "depends" is out of date (and thus gets run)
b) some other prerequisites are not satisfied (i.e. .java is newer than 
.class, or the .jar file is not yet built)

Some examples of standard conditional execution:

idl parsing/code generation: generate .java code only if .idl files 
have been modified
jar file: only run jar if the class files it depends on have been 
regenerated
java compiler: only compile if .java is newer than .class

The last is the only thing that I've seen ant handle automatically, 
although I seem to have a knack for configuring things such that it 
recompiles everything every time.

On a complex project, typically you'll have many smaller targets with 
internal dependencies (and some with prerequisit targets as 
dependencies) and several overall targets that primarily consist of 
prerequisite target dependencies (a jar file or shared library, for 
instance).

On Tuesday, February 18, 2003, at 10:23 AM, Jan.Materne@rzf.fin-nrw.de 
wrote:

> When you use <target name="B" depends="A"/> the Ant framework will
> invoke A before B. Why setting a property?
>
> BTW the "onlyif" is <target if="propertyname"/>
> There is a unless="propertyname", too.
>
>
> Jan Matèrne
>


---------------------------------------------------------------------
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