| 1 | <project default="init"> |
| 2 | <taskdef resource="net/sf/antcontrib/antcontrib.properties"> |
| 3 | <classpath location="${antcontrib.jar}"/> |
| 4 | </taskdef> |
| 5 | |
| 6 | <property name="test.dir" value="timestampselector"/> |
| 7 | <property name="test.file1" location="${test.dir}/file1.txt" /> |
| 8 | <property name="test.file2" location="${test.dir}/file2.txt" /> |
| 9 | <property name="test.dir1" location="${test.dir}/dir1" /> |
| 10 | <property name="test.dir2" location="${test.dir}/dir2" /> |
| 11 | |
| 12 | <fileset id="test.files" dir="${test.dir}"> |
| 13 | <include name="*.txt" /> |
| 14 | </fileset> |
| 15 | |
| 16 | <path id="test.files.path"> |
| 17 | <fileset refid="test.files" /> |
| 18 | </path> |
| 19 | |
| 20 | <dirset id="test.dirs" dir="${test.dir}"> |
| 21 | <include name="dir*" /> |
| 22 | </dirset> |
| 23 | |
| 24 | <path id="test.dirs.path"> |
| 25 | <dirset refid="test.dirs" /> |
| 26 | </path> |
| 27 | |
| 28 | <target name="init"> |
| 29 | <delete quiet ="yes" dir="${test.dir}"/> |
| 30 | <mkdir dir="${test.dir}"/> |
| 31 | <touch file="${test.dir}/file1.txt" /> |
| 32 | <touch file="${test.dir}/file2.txt" /> |
| 33 | <mkdir dir="${test.dir}/dir1"/> |
| 34 | <mkdir dir="${test.dir}/dir2"/> |
| 35 | </target> |
| 36 | |
| 37 | <target name="teardown"> |
| 38 | <delete quiet="yes" dir="${test.dir}" /> |
| 39 | </target> |
| 40 | |
| 41 | <target name="filestamp.fl" depends="init"> |
| 42 | <timestampselector property="latest.fl.tstamp"> |
| 43 | <path> |
| 44 | <fileset refid="test.files" /> |
| 45 | </path> |
| 46 | </timestampselector> |
| 47 | |
| 48 | <echo message="${latest.fl.tstamp}" /> |
| 49 | </target> |
| 50 | |
| 51 | <target name="filestamp.pr" depends="init"> |
| 52 | <timestampselector property="latest.pr.tstamp" |
| 53 | pathref="test.files.path" /> |
| 54 | |
| 55 | <echo message="${latest.pr.tstamp}" /> |
| 56 | </target> |
| 57 | |
| 58 | <target name="dirstamp.dl" depends="init"> |
| 59 | <timestampselector property="latest.dl.tstamp"> |
| 60 | <path> |
| 61 | <dirset refid="test.dirs" /> |
| 62 | </path> |
| 63 | </timestampselector> |
| 64 | |
| 65 | <echo message="${latest.dl.tstamp}" /> |
| 66 | |
| 67 | </target> |
| 68 | |
| 69 | <target name="dirstamp.pr" depends="init"> |
| 70 | <timestampselector property="latest.pr.tstamp" |
| 71 | pathref="test.dirs.path" /> |
| 72 | |
| 73 | <echo message="${latest.pr.tstamp}" /> |
| 74 | </target> |
| 75 | |
| 76 | </project> |