| 1 |
<project default="invalid"> |
| 2 |
<target name="invalid"> |
| 3 |
<fail>Don't call this file directly.</fail> |
| 4 |
</target> |
| 5 |
|
| 6 |
<taskdef resource="net/sf/antcontrib/antcontrib.properties"> |
| 7 |
<classpath location="${antcontrib.jar}"/> |
| 8 |
</taskdef> |
| 9 |
|
| 10 |
<target name="cleanup"> |
| 11 |
<delete quiet="yes" dir="targets"/> |
| 12 |
<delete quiet="yes" dir="sources"/> |
| 13 |
</target> |
| 14 |
|
| 15 |
<target name="init"> |
| 16 |
<mkdir dir="targets"/> |
| 17 |
<mkdir dir="sources"/> |
| 18 |
|
| 19 |
<touch file="sources/s1" millis="100000"/> |
| 20 |
<touch file="targets/t1" millis="100"/> |
| 21 |
<touch file="targets/t2" millis="1000000"/> |
| 22 |
<path id="sources" path="sources/s1"/> |
| 23 |
<path id="targets"> |
| 24 |
<fileset dir="targets"/> |
| 25 |
</path> |
| 26 |
</target> |
| 27 |
|
| 28 |
<target name="simple" depends="init"> |
| 29 |
<outofdate> |
| 30 |
<sourcefiles refid="sources"/> |
| 31 |
<targetfiles refid="targets"/> |
| 32 |
<sequential> |
| 33 |
<property name="simple.called" value=""/> |
| 34 |
</sequential> |
| 35 |
</outofdate> |
| 36 |
<fail unless="simple.called">Simple seq not triggered</fail> |
| 37 |
</target> |
| 38 |
|
| 39 |
<target name="verbose" depends="init"> |
| 40 |
<outofdate verbose="true"> |
| 41 |
<sourcefiles refid="sources"/> |
| 42 |
<targetfiles refid="targets"/> |
| 43 |
</outofdate> |
| 44 |
</target> |
| 45 |
|
| 46 |
<target name="delete" depends="init"> |
| 47 |
<outofdate> |
| 48 |
<sourcefiles refid="sources"/> |
| 49 |
<targetfiles refid="targets"/> |
| 50 |
<deletetargets/> |
| 51 |
</outofdate> |
| 52 |
<if> |
| 53 |
<available file="targets/t1"/> |
| 54 |
<then> |
| 55 |
<fail>delete failed</fail> |
| 56 |
</then> |
| 57 |
</if> |
| 58 |
<if> |
| 59 |
<available file="targets/t2"/> |
| 60 |
<else> |
| 61 |
<fail>delete too much</fail> |
| 62 |
</else> |
| 63 |
</if> |
| 64 |
</target> |
| 65 |
|
| 66 |
<target name="delete-all" depends="init"> |
| 67 |
<outofdate> |
| 68 |
<sourcefiles refid="sources"/> |
| 69 |
<targetfiles refid="targets"/> |
| 70 |
<deletetargets all="true"/> |
| 71 |
</outofdate> |
| 72 |
<if> |
| 73 |
<available file="targets/t1"/> |
| 74 |
<then> |
| 75 |
<fail>delete failed</fail> |
| 76 |
</then> |
| 77 |
</if> |
| 78 |
<if> |
| 79 |
<available file="targets/t2"/> |
| 80 |
<then> |
| 81 |
<fail>delete all failed</fail> |
| 82 |
</then> |
| 83 |
</if> |
| 84 |
</target> |
| 85 |
|
| 86 |
<target name="delete-quiet"> |
| 87 |
<outofdate> |
| 88 |
<sourcefiles refid="sources"/> |
| 89 |
<targetfiles refid="targets"/> |
| 90 |
<deletetargets quiet="yes"/> |
| 91 |
</outofdate> |
| 92 |
</target> |
| 93 |
|
| 94 |
<target name="outofdate.init"> |
| 95 |
|
| 96 |
<mkdir dir="outofdate/source/1/2/3"/> |
| 97 |
<touch file="outofdate/source/newer.text"/> |
| 98 |
<touch file="outofdate/source/1/2/file.notdone"/> |
| 99 |
<touch file="outofdate/source/1/2/file.done"/> |
| 100 |
<touch file="outofdate/source/1/done.y"/> |
| 101 |
<touch file="outofdate/source/1/partial.y"/> |
| 102 |
|
| •103 |
|
| 104 |
<sleep milliseconds="1"/> |
| 105 |
|
| 106 |
|
| 107 |
<mkdir dir="outofdate/gen/1/2/3"/> |
| 108 |
<touch file="outofdate/gen/index.done"/> |
| 109 |
<touch file="outofdate/gen/1/2/file.done"/> |
| 110 |
<touch file="outofdate/gen/1/done.c"/> |
| 111 |
<touch file="outofdate/gen/1/done.h"/> |
| 112 |
<touch file="outofdate/gen/1/partial.c"/> |
| 113 |
</target> |
| 114 |
|
| 115 |
<target name="outofdate.test" depends="outofdate.init"> |
| 116 |
<outofdate |
| 117 |
outputsources="outofdate.sources" |
| 118 |
outputtargets="outofdate.targets" |
| 119 |
alltargets="outofdate.alltargets" |
| 120 |
outputsourcespath="outofdate.sources.path" |
| 121 |
outputtargetspath="outofdate.targets.path" |
| 122 |
> |
| 123 |
<sourcefiles> |
| 124 |
<fileset dir="outofdate/source"/> |
| 125 |
<pathelement path="outofdate.xml"/> |
| 126 |
</sourcefiles> |
| 127 |
<targetfiles path="outofdate/gen/index.done"/> |
| 128 |
<mapper type="glob" from="outofdate/source/1/2/*" |
| 129 |
to="outofdate/gen/1/2/*"/> |
| 130 |
<mapper type="glob" |
| 131 |
from="outofdate/source/*.y" |
| 132 |
to="outofdate/gen/*.c"/> |
| 133 |
<mapper type="glob" |
| 134 |
from="outofdate/source/*.y" |
| 135 |
to="outofdate/gen/*.h"/> |
| 136 |
<mapper type="glob" |
| 137 |
from="outofdate/source/newer.text" |
| 138 |
to="outofdate.xml"/> |
| 139 |
<sequential> |
| 140 |
<echo message="outofdate triggered"/> |
| 141 |
</sequential> |
| 142 |
</outofdate> |
| 143 |
<delete dir="outofdate"/> |
| 144 |
</target> |
| 145 |
|
| 146 |
<target name="empty-sources" depends="init"> |
| 147 |
<outofdate> |
| 148 |
<sourcefiles/> |
| 149 |
<targetfiles path="THIS IS NOT PRESENT"/> |
| 150 |
<sequential> |
| 151 |
<property name="empty-sources.called" value=""/> |
| 152 |
</sequential> |
| 153 |
</outofdate> |
| 154 |
<fail unless="empty-sources.called">Empty sources seq not triggered</fail> |
| 155 |
</target> |
| 156 |
|
| 157 |
</project> |