1

I am using Ant to build a fileset. I only want to include files in the file set that have been modified after a specific date. (See below)

Ideally I would like the below datetime value to be some sort of property that is equal to the create date of the build file. E.g. I only want files included in the fileset that where modified after the build file was created I cant use a static string because this build file will be checked out from subversion by multiple developers.

<fileset dir="some-files">
    <date datetime="07/12/2010 12:00 AM" when="after"/>
</fileset>
tinny
  • 4,232
  • 7
  • 28
  • 38

2 Answers2

1

You could use the Date svn keyword in one of your property files, so your property would look like:

file.mod.date=$LastChangedDate$

once you have set the svn:keywords property on your property file (see the svn propset command), commited your changes checking out the property file will result in your property looking something like:

file.mod.date=$LastChangedDate: 2006-07-22 21:42:37 -0700 (Sat, 22 Jul 2006) $

Now you have an ant property with a date inside of it, there are a couple of ways to substring the property so you can use the raw date.

Community
  • 1
  • 1
krock
  • 28,904
  • 13
  • 79
  • 85
  • I wonder if I could use this technique to add the date directly into the build file? – tinny Jul 12 '10 at 09:12
  • @tinny, there is nothing stopping you from doing that ``. Just make sure to add the appropriate `svn propset` on the file you want svn keyword replacement on. – krock Jul 12 '10 at 23:40
1

Sorry, I can't test this at the moment, but it seems like you could do something like:

<fileset dir="${some-dir}">
    <depend targetdir="${basedir}">
        <mergemapper to="${ant.file}"/>
    </depend>
</fileset>

Without testing, I'm not sure what the exact interaction is between depend and mergemapper, but hopefully you get the idea...

kschneid
  • 5,626
  • 23
  • 31
  • Just noticed that the original question stated: "...only want files included in the fileset that where modified after the build file was created..." The `depend` selector uses modification time, not creation time. – kschneid Jul 12 '10 at 16:55