ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: [SUBMIT] New <dependset> task, a task to manage arbitrary dependencies between files
Date Tue, 31 Jul 2001 06:48:22 GMT
On Fri, 27 Jul 2001, Craeg K. Strong <>

> an example might help.  
> <dependset>
>    <srcfiles dir="bar" includes="my-buildfile.xml"/>
>    <targetfiles dir="foo" includes = "**/*.html"/>
>    <targetfiles dir="baz" includes="**/*.class"/>
> </dependset>
> Here we want to ensure that our java and XML source files get
> re-compiled if the buildfile changes.
> If any of the HTML or class files does not exist yet, no problem--
> they will be generated in the usual way using <javac> <style> or
> whatever.

In your case, but what if the task doesn't know it will have to run as
it cannot compute the specific missing file?

Let's take a silly example - my <style> (using redirect extensions or
something) generates two .html files - the name of one of them will be
passed in as a parameter, something like

<style in="source.xml" 
  <param name="other-file"
         value="${a-property-only-known-at-build-time}" />

This style task won't run if it gets invoked in two consecutive builds
with different values of the property (as the task doesn't know about
the second file).  If you use a targetfiles-fileset, you won't catch
that either.

> If any of the HTML or class files is NEWER than the buildfile, I
> don't need to remove them.

Also not true in my scenario above - maybe output1.html contains a
link to the second file?  If any target file is out of date with
respect to a given source, chances are high that all of them are IMHO.

But I see your point of using a fileset for target files as well,
there are situations where you don't know all the names of the target
files or it would be cumbersome to list them.

Maybe we'd need a targetfileset and a targetfilelist or similar, where
a missing file from the targetfilelist would be treated the same way
as an out-of-date target file?

I still would remove all targets if one is out-of-date.

> The reason I use a fileset for the sources and not just a list of
> files is for convenience.

No argument here.

> A real issue is what to do when one or more SOURCES (not targets)
> doesn't exist?  In the example above, that would mean that a
> buildfile does not exist.  This is not so preposterous when you
> realize that I might be generating my buildfile using XSLT or
> whatnot.

Then place the dependset task after the one that generates the build

> Other times you might want this situation to be interpreted as if
> the target files are NOT out of date.  For example, you might have a
> boilerplate <dependset> rule that includes "*.dtd".  But one of your
> projects does not yet happen to have any DTD files.  Setting
> ignore=true means that this will not result in any target files
> being removed.

Searching for sources that have an out-of-date target instead of
targets that are out of date would eliminate this problem, you
wouldn't even consider the *.dtd part.


View raw message