Bug 10283 - Add a destfile to the uptodate task
Summary: Add a destfile to the uptodate task
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.7.0
Hardware: Other other
: P3 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2002-06-27 14:33 UTC by Guillaume Cot
Modified: 2008-11-24 03:57 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Cot 2002-06-27 14:33:40 UTC
I would like to suggest an enhancement to the Uptodate task (and
Condition/uptodate).  In my particular, I have several generated files that are
generated by a lot of file.  For now, I arbitrary choose one file as the target
file and compare all the source files to that one.

Instead of specifying a mapper, I would like to directly a specify a file set of
destination files (or a reference to it).  I would list the task to check if the
oldest destfile is newer that the newest source file.
Comment 1 Stephane Bailliez 2002-08-15 21:08:55 UTC
I'm not sure to clearly understand what you want based on your description and 
your summary. I don't see any relation with some sort of 'destfile' (which 
name is close to 'targetfile') and a fileset(oldest)/fileset(newest)
Comment 2 Guillaume Cot 2002-08-20 09:13:51 UTC
Maybe it would be more clear with a example.

I have a task call ejbdoclet which generate a lot of files base on some
javasource.  For now, I have the following in my build.xml.

        <uptodate property="prod.ejbdoclet.notRequired">
            <srcfiles refid="prod.ejbdoclet.src.fileset"/>
            <mapper type="merge" to="${prod.meta.tmp.dir}/ejb-jar.xml"/>

For now, I check all my file against a single target file : ejb-jar.xml.  What I
would like would look like :

        <uptodate property="prod.ejbdoclet.notRequired">
            <srcfiles refid="prod.ejbdoclet.src.fileset"/>
            <targetfiles dir="${build.dir}">
               <include name="metadata/ejb-jar.xml"/>
               <include name="metadata/weblogic-ejb-jar.xml"/>
               <include name="metadata/weblogic-cmp-rdbms-jar.xml"/>
               <include name="gensrc/**/*Remote.java"/>
               <include name="gensrc/**/*RemoteHome.java"/>
               <include name="gensrc/**/*Local.java"/>
               <include name="gensrc/**/*LocalHome.java"/>
               <include name="gensrc/**/*Data.java"/>

when the property is set only when all the file in targetfiles are newer that
the newer file in srcfiles.
Comment 3 Stefan Bodewig 2003-03-27 13:52:03 UTC
What would you want to see happen if ${build.dir}/metadata/ejb-jar.xml isn't
there at all?  The fileset wouldn't mind and uptodate would happily consider
the targetfiles up-to-date.
Comment 4 Guillaume Cot 2003-03-27 15:07:31 UTC
No the opposite, the targetfiles are consider update only if they all exist and
the oldest targetfile is younger that that the youngest sourcefile.

If you assume that nonexisting file are ok, I would have to make and between an
available element and an uptodate element.
Comment 5 Stefan Bodewig 2003-03-27 15:18:52 UTC
I've not been clear enough.

What I described, is the behavior of fileset.  Your idea wouldn't catch the missing
targetfile as filesets don't care if some include patterns don't match anything.

<filelist> may be what you want, but then you don't get any pattern matching.

What are you going to do, if you detect that something is not uptodate?
May <dependset> help you?  You could probably use <dependset> followed by
<available> for ejb-jar.xml.  If it is still there, things have been up-to-date.
Comment 6 Dominique Devienne 2003-03-27 15:42:12 UTC
Actually, <uptodate> and <dependset> are pretty much superseded by Peter's 
<outofdate> available from Ant-Contrib on SF.NET. Go get it, and you'll be 
happy you did ;-) See recent ant-contrib-dev mailing lists for recent posts 
about it's use. --DD