开发者

Using Ant date properties?

开发者 https://www.devze.com 2023-01-06 15:13 出处:网络
I am using Ant to build a fileset. I only want to include files in the file set that have been modified a开发者_开发技巧fter a specific date. (See below)

I am using Ant to build a fileset. I only want to include files in the file set that have been modified a开发者_开发技巧fter 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>


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.


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消