ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gle...@ca.ibm.com
Subject RE: Skipping tasks
Date Thu, 09 Nov 2000 14:55:18 GMT


Why not use the <uptodate> task?  It sets a property if a particular file
is more up to date (has a more recent timestamp) than a set of files.  So
do

<target name="build" depends="compile,manifest,need_to_jar,jar">
</target>

... compile and manifest targets ...

<target name="need_to_jar">
  <uptodate targetfile="${the.jar.file.name}" property="jar.up.to.date">
    <srcfiles dir="${compiled.class.files.directory}" />
  </uptodate>
</target>

<target name="jar" unless="jar.up.to.date">
  ... do your jarring ...
</target>

Not tested, but this should work.

Glenn McAllister
Software Developer. IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey


Please respond to ant-dev@jakarta.apache.org; Please respond to
      emeade@geekfarm.org

To:   ant-dev@jakarta.apache.org
cc:
Subject:  RE: Skipping tasks

Okay, so the existing functionality doesn't seem to exists.  Task
is an abstract class (I just updated to make sure I have the most
recent version).  So, if it's implemented the way you describe, it
will still be backward compatible :)

I'm an Xper (Extreme Programmer) and I love using Ant to run my
JUnit test, so I run it often.  Even little time savings add up
for me.

Erik

> -----Original Message-----
> From: Jon Tirsén [mailto:jon.tirsen@emm.com]
> Sent: Wednesday, November 08, 2000 7:39 PM
> To: ant-dev@jakarta.apache.org
> Subject: RE: Skipping tasks
>
>
> The requirements for implementing such functionality is that there is an
> ability to ask a task "did you do something?". Ie. the Task
> interface has a
> method "boolean isUpToDate()" (or something). To my understanding there
is
> no such thing on the Task-interface.
>
> It would be possible to add something like that but that would break the
> existing tasks. If there was a base-class for the tasks (instead of an
> interface) one could add such a method that by default returns
> false (ie. is
> not up-to-date), so that it is always run by default and if one wanted to
> support such optimization one returns true at the correct times.
>
> The question though is how much time would actually be saved? I think
that
> some time might actually be saved since it doesn't need to hit the disk
as
> often and that many tasks could be skipped in a long chain. (For my own
> current project I really expect the time-savings could be potential.) But
> this is just guessing...
>
> -----Original Message-----
> From: Erik Meade [mailto:emeade@geekfarm.org]
> Sent: Wednesday, November 08, 2000 7:14 PM
> To: ant-dev@jakarta.apache.org
> Subject: Skipping tasks
>
>
> I'm wondering about allowing tasks to be "skipped" if the tasks they are
> dependent on do nothing.  Lets say I have three targets, A, B, and C.  C
> is dependent on A and B.  A compiles my source files to a classes
> directory, B copies over the manifest and/or the deployment descriptor C
> jars them up. If A doesn't compile any files and B doesn't copy over the
> files because they haven't changed, I would prefer that C not jar.
>
> If memory serves me correctly having the jar task verify all the dates
> doesn't get you much until you have a large number of files, but it seems
> to me maybe there would be a way to "infer" that since A and B did
> nothing, C should do nothing too?
>
> Anyway to do this now?  Any reason someone shouldn't try to add this
> functionality if it doesn't already exists?
>
> Erik Meade





Mime
View raw message