ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bert Vermeerbergen" <Bert.Vermeerber...@yucom.be>
Subject RE: How to do something only when it is needed ?
Date Tue, 06 Mar 2001 16:13:05 GMT
"philippe.lavoie@cactus.ca" <philippe.lavoie@cactus.ca> wrote:

> Some of my tasks should only be executed when some files are modified, how
> can I tell the task that ?

Depending on the task, this may be built-in (like the javac task, compiling only the modified
.java files)
Another possibility is to use the 'uptodate' task to set a property when a target file is
more recent than a number
of other files you specify, and then use a target that is executed only when the property
is not set.

<target name="main" depends="check,create" />

<target name="check">
    <uptodate property="dont.create" targetfile="./file_to_create">
        <srcfiles dir="." includes="**/*.xml" />
    </uptodate>
</target>

<target name="create" unless="dont.create">
    <your task here, should create the ./file_to_create.../>
</target>

Build the "main" target, this will check first and then create only when target not up to
date.

Mime
View raw message