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