source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/etc/testcases/taskdefs/exec/apply.xml@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 16.1 KB
Line 
1<project name="apply-test" basedir=".">
2 <target name="init">
3 <property environment="env"/>
4 <!-- UNIX -->
5 <available file="sh" filepath="${env.PATH}" property="sh.executable"/>
6 <!-- CYGWIN -->
7 <available file="sh.exe" filepath="${env.PATH}" property="sh.exe.executable"/>
8 <condition property="test.can.run">
9 <or>
10 <isset property="sh.executable"/>
11 <isset property="sh.exe.executable"/>
12 </or>
13 </condition>
14 <!-- UNIX -->
15 <available file="sed" filepath="${env.PATH}" property="sed.executable"/>
16 <!-- CYGWIN -->
17 <available file="sed.exe" filepath="${env.PATH}" property="sed.exe.executable"/>
18 <condition property="sed.can.run">
19 <or>
20 <isset property="sed.executable"/>
21 <isset property="sed.exe.executable"/>
22 </or>
23 </condition>
24 <!-- UNIX -->
25 <available file="echo" filepath="${env.PATH}" property="echo.executable"/>
26 <!-- CYGWIN -->
27 <available file="echo.exe" filepath="${env.PATH}" property="echo.exe.executable"/>
28 <condition property="echo.can.run">
29 <or>
30 <isset property="echo.executable"/>
31 <isset property="echo.exe.executable"/>
32 </or>
33 </condition>
34 </target>
35
36 <target name="xyz">
37 <echo file="x">s/x/blah/g${line.separator}</echo>
38 <echo file="y">s/y/blah/g${line.separator}</echo>
39 <echo file="z">s/z/blah/g${line.separator}</echo>
40 <fileset id="xyz" dir="${basedir}" includes="x,y,z" />
41 <filelist id="xyzlist" dir="${basedir}" files="x,y,z" />
42 </target>
43
44 <target name="no-redirect" depends="init,xyz" if="test.can.run">
45 <apply executable="sh">
46 <arg value="parrot.sh"/>
47 <fileset refid="xyz" />
48 </apply>
49 </target>
50
51 <target name="redirect1" depends="init,xyz" if="test.can.run">
52 <apply executable="sh" output="redirect.out" append="true">
53 <arg value="parrot.sh"/>
54 <fileset refid="xyz" />
55 </apply>
56 </target>
57
58 <target name="redirect2" depends="init,xyz" if="test.can.run">
59 <apply executable="sh" output="redirect.out"
60 error="redirect.err" append="true">
61 <arg value="parrot.sh"/>
62 <fileset refid="xyz" />
63 </apply>
64 </target>
65
66 <target name="redirect3" depends="init,xyz" if="test.can.run">
67 <apply executable="sh" logerror="true" append="true"
68 output="redirect.out" outputproperty="redirect.out">
69 <arg value="parrot.sh"/>
70 <fileset refid="xyz" />
71 </apply>
72 </target>
73
74 <target name="redirect4" depends="init,xyz" if="test.can.run">
75 <apply executable="sh" append="true"
76 error="redirect.err" errorproperty="redirect.err"
77 output="redirect.out" outputproperty="redirect.out">
78 <arg value="parrot.sh"/>
79 <fileset refid="xyz" />
80 </apply>
81 </target>
82
83 <target name="redirect5" depends="init,xyz" if="sed.can.run">
84 <apply executable="sed" inputstring="x y z${line.separator}" append="true"
85 error="redirect.err" errorproperty="redirect.err"
86 output="redirect.out" outputproperty="redirect.out">
87 <arg value="-f" />
88 <fileset refid="xyz" />
89 </apply>
90 </target>
91
92 <target name="redirect6" depends="init,xyz" if="sed.can.run">
93 <echo file="redirect.in">x y z${line.separator}</echo>
94 <apply executable="sed" input="redirect.in" append="true"
95 error="redirect.err" errorproperty="redirect.err"
96 output="redirect.out" outputproperty="redirect.out">
97 <arg value="-f" />
98 <filelist refid="xyzlist" />
99 </apply>
100 </target>
101
102 <target name="redirect7" depends="init,xyz" if="sed.can.run">
103 <apply executable="sed" inputstring="x y z${line.separator}"
104 error="redirect.err" output="redirect.out"
105 outputproperty="redirect.out">
106 <arg value="-f" />
107 <fileset refid="xyz" />
108 </apply>
109 </target>
110
111 <target name="redirector1" description="fail"
112 depends="init,xyz" if="test.can.run">
113 <apply executable="sh">
114 <arg value="parrot.sh"/>
115 <fileset refid="xyz" />
116 <redirector output="redirector.out" />
117 <redirector output="whocares" />
118 </apply>
119 </target>
120
121 <target name="redirector2" depends="init,xyz" if="test.can.run">
122 <apply executable="sh">
123 <arg value="parrot.sh"/>
124 <fileset refid="xyz" />
125 <redirector output="redirector.out" append="true" />
126 </apply>
127 </target>
128
129 <target name="redirector3" depends="init,xyz" if="test.can.run">
130 <apply executable="sh">
131 <arg value="parrot.sh"/>
132 <fileset refid="xyz" />
133 <redirector append="true"
134 output="redirector.out" error="redirector.err" />
135 </apply>
136 </target>
137
138 <target name="redirector4" depends="init,xyz" if="test.can.run">
139 <apply executable="sh">
140 <arg value="parrot.sh"/>
141 <fileset refid="xyz" />
142 <redirector output="redirector.out" logerror="true"
143 append="true" outputproperty="redirector.out" />
144 </apply>
145 </target>
146
147 <target name="redirector5" depends="init,xyz" if="test.can.run">
148 <apply executable="sh">
149 <redirector error="redirector.err" errorproperty="redirector.err"
150 output="redirector.out" outputproperty="redirector.out"
151 append="true" />
152 <arg value="parrot.sh"/>
153 <fileset refid="xyz" />
154 </apply>
155 </target>
156
157 <target name="redirector6" depends="init,xyz" if="test.can.run">
158 <apply executable="sh">
159 <redirector append="true" outputproperty="redirector.out"
160 errorproperty="redirector.err">
161 <outputmapper type="merge" to="redirector.out" />
162 <errormapper type="merge" to="redirector.err" />
163 </redirector>
164 <arg value="parrot.sh" />
165 <filelist refid="xyzlist" />
166 </apply>
167 </target>
168
169 <target name="redirector7" depends="init,xyz" if="test.can.run">
170 <apply executable="sh">
171 <redirector append="true" outputproperty="redirector.out"
172 errorproperty="redirector.err">
173 <outputmapper type="merge" to="redirector.out" />
174 <errormapper type="merge" to="redirector.err" />
175 <errorfilterchain>
176 <replacestring from="err" to="ERROR!!!" />
177 </errorfilterchain>
178 </redirector>
179 <arg value="parrot.sh" />
180 <fileset refid="xyz" />
181 </apply>
182 </target>
183
184 <target name="redirector8" depends="init,xyz" if="sed.can.run">
185 <echo file="redirector.in">x y z${line.separator}</echo>
186 <apply executable="sed">
187 <redirector append="true" outputproperty="redirector.out"
188 errorproperty="redirector.err">
189 <inputmapper type="merge" to="redirector.in" />
190 <outputmapper type="merge" to="redirector.out" />
191 <errormapper type="merge" to="redirector.err" />
192 </redirector>
193 <arg value="-f" />
194 <fileset refid="xyz" />
195 </apply>
196 </target>
197
198 <target name="redirector9" depends="init,xyz" if="sed.can.run">
199 <echo file="redirector.in">x before y before z${line.separator}</echo>
200 <apply executable="sed">
201 <redirector outputproperty="redirector.out"
202 errorproperty="redirector.err" append="true">
203 <inputfilterchain>
204 <replacestring from="before" to="after" />
205 </inputfilterchain>
206 <inputmapper type="merge" to="redirector.in" />
207 <outputmapper type="merge" to="redirector.out" />
208 <errormapper type="merge" to="redirector.err" />
209 </redirector>
210 <arg value="-f" />
211 <fileset refid="xyz" />
212 </apply>
213 </target>
214
215 <target name="redirector10" depends="init,xyz" if="sed.can.run">
216 <echo file="redirector.in">x before y before z${line.separator}</echo>
217 <apply executable="sed">
218 <redirector outputproperty="redirector.out"
219 errorproperty="redirector.err" append="true">
220 <outputfilterchain>
221 <replacestring from="before" to="after" />
222 </outputfilterchain>
223 <outputmapper type="merge" to="redirector.out" />
224 <errormapper type="merge" to="redirector.err" />
225 </redirector>
226 <arg value="-f" />
227 <srcfile />
228 <arg value="redirector.in"/>
229 <filelist refid="xyzlist" />
230 </apply>
231 </target>
232
233 <target name="redirector11" depends="init,xyz" if="sed.can.run">
234 <apply executable="sed">
235 <redirector outputproperty="redirector.out"
236 errorproperty="redirector.err"
237 inputstring="x before y before z${line.separator}"
238 append="true">
239 <inputfilterchain>
240 <replacestring from="before" to="after" />
241 </inputfilterchain>
242 <outputmapper type="merge" to="redirector.out" />
243 <errormapper type="merge" to="redirector.err" />
244 </redirector>
245 <arg value="-f" />
246 <fileset refid="xyz" />
247 </apply>
248 </target>
249
250 <target name="redirector12" depends="init,xyz" if="sed.can.run">
251 <echo file="redirector.in">x before y before z${line.separator}</echo>
252 <apply executable="sed" output="redirector.out" error="redirector.err">
253 <redirector outputproperty="redirector.out"
254 errorproperty="redirector.err" append="true">
255 <outputfilterchain>
256 <replacestring from="before" to="after" />
257 </outputfilterchain>
258 <outputmapper type="glob" from="nomatch" to="nomatchout" />
259 <errormapper type="glob" from="nomatch" to="nomatcherr" />
260 </redirector>
261 <arg value="-f" />
262 <srcfile />
263 <arg value="redirector.in"/>
264 <filelist refid="xyzlist" />
265 </apply>
266 </target>
267
268 <target name="redirector13" depends="init,xyz" if="test.can.run">
269 <apply executable="sh">
270 <redirector>
271 <outputfilterchain>
272 <replacestring from="out" to="OUTPUT???" />
273 </outputfilterchain>
274 <errorfilterchain>
275 <replacestring from="err" to="ERROR!!!" />
276 </errorfilterchain>
277 </redirector>
278 <arg value="parrot.sh" />
279 <fileset refid="xyz" />
280 </apply>
281 </target>
282
283 <target name="redirector14" depends="init,xyz" if="sed.can.run">
284 <echo file="redirector.in">z before y before x${line.separator}</echo>
285 <apply executable="sed">
286 <redirector append="true"
287 inputstring="x before y before z${line.separator}">
288 <outputfilterchain>
289 <replacestring from="before" to="after" />
290 </outputfilterchain>
291 <inputmapper type="glob" from="x" to="redirector.in" />
292 <outputmapper type="glob" from="y" to="redirector.out" />
293 <errormapper type="glob" from="z" to="redirector.err" />
294 </redirector>
295 <arg value="-f" />
296 <fileset refid="xyz" />
297 </apply>
298 </target>
299
300 <target name="redirector14b" depends="init,xyz" if="sed.can.run">
301 <apply executable="sed">
302 <redirector append="true"
303 inputstring="x before y before z${line.separator}">
304 <outputfilterchain>
305 <replacestring from="before" to="after" />
306 </outputfilterchain>
307 <inputmapper type="glob" from="x" to="redirector.in" />
308 <outputmapper type="glob" from="y" to="redirector.out" />
309 <errormapper type="glob" from="z" to="redirector.err" />
310 </redirector>
311 <arg value="-f" />
312 <fileset file="y" />
313 </apply>
314 </target>
315
316 <target name="pad">
317 <condition property="pad" value="">
318 <or>
319 <not>
320 <os family="dos" />
321 </not>
322 <not>
323 <or>
324 <equals arg1="${ant.java.version}" arg2="1.1" />
325 <equals arg1="${ant.java.version}" arg2="1.2" />
326 </or>
327 </not>
328 </or>
329 </condition>
330
331 <condition property="pad" value=" ">
332 <and>
333 <os family="dos" />
334 <or>
335 <equals arg1="${ant.java.version}" arg2="1.1" />
336 <equals arg1="${ant.java.version}" arg2="1.2" />
337 </or>
338 </and>
339 </condition>
340
341 </target>
342
343 <target name="ignoremissing" depends="init,xyz,pad" if="echo.can.run">
344 <filelist id="xylist" dir="${basedir}" files="x,y" />
345 <delete file="z" />
346
347 <pathconvert property="xy" pathsep="${pad}${line.separator}">
348 <path>
349 <filelist refid="xylist" />
350 </path>
351 </pathconvert>
352
353 <pathconvert property="xyz" pathsep="${pad}${line.separator}">
354 <path>
355 <filelist refid="xyzlist" />
356 </path>
357 </pathconvert>
358
359 <apply executable="echo" ignoremissing="true"
360 outputproperty="ignoretrue" append="true">
361 <filelist refid="xyzlist" />
362 </apply>
363
364 <apply executable="echo" ignoremissing="false"
365 outputproperty="ignorefalse" append="true">
366 <filelist refid="xyzlist" />
367 </apply>
368
369 <fail>
370 <condition>
371 <not>
372 <and>
373 <equals arg1="${xy}${pad}" arg2="${ignoretrue}" />
374 <equals arg1="${xyz}${pad}" arg2="${ignorefalse}" />
375 </and>
376 </not>
377 </condition>
378 </fail>
379 </target>
380
381 <target name="force" depends="init,xyz,pad" if="echo.can.run">
382 <presetdef name="ekko">
383 <apply executable="echo" append="true" dest="${basedir}">
384 <filelist refid="xyzlist" />
385 <mapper type="identity" />
386 </apply>
387 </presetdef>
388
389 <pathconvert property="xyz" pathsep="${pad}${line.separator}">
390 <path>
391 <filelist refid="xyzlist" />
392 </path>
393 </pathconvert>
394
395 <ekko outputproperty="foo" />
396 <ekko outputproperty="bar" force="true" />
397 <fail>
398 <condition>
399 <not>
400 <and>
401 <equals arg1="${foo}" arg2="" />
402 <equals arg1="${bar}" arg2="${xyz}" />
403 </and>
404 </not>
405 </condition>
406 </fail>
407 </target>
408
409 <target name="testNoDest" depends="init,xyz" if="echo.can.run">
410 <presetdef name="ekko">
411 <apply executable="echo" addsourcefile="false" force="true">
412 <filelist dir="${basedir}" files="x" />
413 <globmapper from="*" to="${basedir}/*" />
414 <targetfile />
415 </apply>
416 </presetdef>
417 <ekko outputproperty="dest" dest="${basedir}" />
418 <ekko outputproperty="nodest" />
419 <fail>
420 <condition>
421 <or>
422 <available file="${dest}" />
423 <not>
424 <available file="${nodest}" />
425 </not>
426 </or>
427 </condition>
428 </fail>
429 </target>
430
431 <target name="cleanup">
432 <delete>
433 <fileset refid="xyz" />
434 <fileset dir="${basedir}" includes="redirect.*" />
435 <fileset dir="${basedir}" includes="redirector.*" />
436 </delete>
437 </target>
438</project>
Note: See TracBrowser for help on using the repository browser.