blob: 00e8c8ab904cee008b43c7ab050a810c92eae7c7 (
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
|
<project default="invalid">
<target name="invalid">
<fail>Don't call this file directly.</fail>
</target>
<target name="setup">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath location="${antcontrib.jar}"/>
</taskdef>
</target>
<target name="teardown">
<delete dir="foreachtest"/>
</target>
<target name="echo">
<echo>Called with param: ${param}</echo>
</target>
<target name="convert-bar" unless="param">
<property name="param" refid="bar"/>
</target>
<target name="echoFilename" depends="convert-bar">
<basename file="${param}" property="param2"/>
<echo>Called with param: ${param2}</echo>
</target>
<target name="simpleList" depends="setup">
<foreach list="1,2,3" target="echo" param="param"/>
</target>
<target name="delimiter" depends="setup">
<foreach list="1/2/3" target="echo" param="param" delimiter="/"/>
</target>
<target name="fileset" depends="setup">
<mkdir dir="foreachtest"/>
<touch file="foreachtest/1"/>
<touch file="foreachtest/2"/>
<touch file="foreachtest/3"/>
<foreach target="echoFilename" param="param">
<fileset dir="foreachtest"/>
</foreach>
</target>
<target name="filesetAndList" depends="setup">
<mkdir dir="foreachtest"/>
<touch file="foreachtest/3"/>
<foreach list="1,2" target="echoFilename" param="param">
<fileset dir="foreachtest"/>
</foreach>
</target>
<target name="noList" depends="setup">
<foreach target="echo" param="param"/>
</target>
<target name="noTarget" depends="setup">
<foreach list="1,2,3" param="param"/>
</target>
<target name="noParam" depends="setup">
<foreach list="1,2,3" target="echo"/>
</target>
<target name="nestedParam" depends="setup">
<foreach list="1" target="echo" param="who-cares">
<param name="param" value="rincewind"/>
</foreach>
</target>
<target name="nestedReference" depends="setup">
<path id="foo">
<pathelement location="twoflower"/>
</path>
<foreach list="1" target="echoFilename" param="who-cares">
<reference refid="foo" torefid="bar"/>
</foreach>
</target>
<target name="path" depends="setup">
<mkdir dir="foreachtest"/>
<touch file="foreachtest/1"/>
<touch file="foreachtest/2"/>
<touch file="foreachtest/3"/>
<foreach target="echoFilename" param="param">
<path>
<fileset dir="foreachtest"/>
</path>
</foreach>
</target>
<target name="pathAndList" depends="setup">
<mkdir dir="foreachtest"/>
<touch file="foreachtest/3"/>
<foreach list="1,2" target="echoFilename" param="param">
<path>
<fileset dir="foreachtest"/>
</path>
</foreach>
</target>
</project>
|