1 | <project>
|
---|
2 |
|
---|
3 | <target name="simple">
|
---|
4 | <macrodef name="my.echo">
|
---|
5 | <attribute name="text"/>
|
---|
6 | <sequential>
|
---|
7 | <echo message="@{text}"/>
|
---|
8 | </sequential>
|
---|
9 | </macrodef>
|
---|
10 | <my.echo text="Hello World"/>
|
---|
11 | </target>
|
---|
12 |
|
---|
13 | <target name="text">
|
---|
14 | <macrodef name="my.echo">
|
---|
15 | <attribute name="text"/>
|
---|
16 | <sequential>
|
---|
17 | <echo>@{text}</echo>
|
---|
18 | </sequential>
|
---|
19 | </macrodef>
|
---|
20 | <my.echo text="Inner Text"/>
|
---|
21 | </target>
|
---|
22 |
|
---|
23 | <target name="duplicate.attribute">
|
---|
24 | <macrodef name="my.echo">
|
---|
25 | <attribute name="text"/>
|
---|
26 | <attribute name="text"/>
|
---|
27 | <sequential>
|
---|
28 | <echo>@{text}</echo>
|
---|
29 | </sequential>
|
---|
30 | </macrodef>
|
---|
31 | </target>
|
---|
32 |
|
---|
33 | <target name="duplicate.element">
|
---|
34 | <macrodef name="my.echo">
|
---|
35 | <element name="text"/>
|
---|
36 | <element name="text"/>
|
---|
37 | <sequential>
|
---|
38 | <text/>
|
---|
39 | </sequential>
|
---|
40 | </macrodef>
|
---|
41 | </target>
|
---|
42 |
|
---|
43 | <target name="uri">
|
---|
44 | <macrodef name="echo" uri="abc">
|
---|
45 | <attribute name="text"/>
|
---|
46 | <sequential>
|
---|
47 | <echo message="@{text}"/>
|
---|
48 | </sequential>
|
---|
49 | </macrodef>
|
---|
50 | <x:echo xmlns:x="abc" text="Hello World"/>
|
---|
51 | </target>
|
---|
52 |
|
---|
53 | <target name="nested">
|
---|
54 | <macrodef name="nested">
|
---|
55 | <element name="nested"/>
|
---|
56 | <sequential>
|
---|
57 | <nested/>
|
---|
58 | </sequential>
|
---|
59 | </macrodef>
|
---|
60 |
|
---|
61 | <nested>
|
---|
62 | <nested>
|
---|
63 | <echo>A nested element</echo>
|
---|
64 | </nested>
|
---|
65 | </nested>
|
---|
66 | </target>
|
---|
67 |
|
---|
68 | <target name="double">
|
---|
69 | <macrodef name="double">
|
---|
70 | <attribute name="prop"/>
|
---|
71 | <sequential>
|
---|
72 | <echo>@@{prop} is '@{prop}', value of $${@{prop}} is '${@{prop}}'</echo>
|
---|
73 | </sequential>
|
---|
74 | </macrodef>
|
---|
75 | <property name="property" value="A property value"/>
|
---|
76 | <double prop="property"/>
|
---|
77 | </target>
|
---|
78 |
|
---|
79 | <target name="ignorecase">
|
---|
80 | <macrodef name="ignore">
|
---|
81 | <attribute name="MyAttribute"/>
|
---|
82 | <sequential>
|
---|
83 | <echo>@{myattribute} is @{MYATTRIBUTE}</echo>
|
---|
84 | </sequential>
|
---|
85 | </macrodef>
|
---|
86 | <ignore myattribute="a"/>
|
---|
87 | <ignore Myattribute="b"/>
|
---|
88 | </target>
|
---|
89 |
|
---|
90 | <target name="ignore-element-case">
|
---|
91 | <macrodef name="ignore">
|
---|
92 | <element name="MyElement"/>
|
---|
93 | <sequential>
|
---|
94 | <myElement/>
|
---|
95 | <MyElEmEnT/>
|
---|
96 | </sequential>
|
---|
97 | </macrodef>
|
---|
98 | <ignore>
|
---|
99 | <MYELEMENT>
|
---|
100 | <echo>nested element</echo>
|
---|
101 | </MYELEMENT>
|
---|
102 | </ignore>
|
---|
103 | </target>
|
---|
104 |
|
---|
105 | <target name="textelement">
|
---|
106 | <macrodef name="echotest">
|
---|
107 | <text name="text" optional="yes"/>
|
---|
108 | <sequential>
|
---|
109 | <echo>@{text}</echo>
|
---|
110 | </sequential>
|
---|
111 | </macrodef>
|
---|
112 | <echotest>
|
---|
113 | Hello world
|
---|
114 | </echotest>
|
---|
115 | </target>
|
---|
116 |
|
---|
117 | <target name="text.trim">
|
---|
118 | <macrodef name="echotest">
|
---|
119 | <text name="text" trim="yes"/>
|
---|
120 | <sequential>
|
---|
121 | <echo>[@{text}]</echo>
|
---|
122 | </sequential>
|
---|
123 | </macrodef>
|
---|
124 | <echotest>
|
---|
125 | Hello world
|
---|
126 | </echotest>
|
---|
127 | </target>
|
---|
128 |
|
---|
129 | <target name="duplicatetextname">
|
---|
130 | <macrodef name="echotest">
|
---|
131 | <attribute name="text"/>
|
---|
132 | <text name="text"/>
|
---|
133 | <sequential>
|
---|
134 | <echo>@{text}</echo>
|
---|
135 | </sequential>
|
---|
136 | </macrodef>
|
---|
137 | </target>
|
---|
138 |
|
---|
139 | <target name="duplicatetextname2">
|
---|
140 | <macrodef name="echotest">
|
---|
141 | <text name="text"/>
|
---|
142 | <attribute name="text"/>
|
---|
143 | <sequential>
|
---|
144 | <echo>@{text}</echo>
|
---|
145 | </sequential>
|
---|
146 | </macrodef>
|
---|
147 | </target>
|
---|
148 |
|
---|
149 | <target name="escape">
|
---|
150 | <macrodef name="escape">
|
---|
151 | <attribute name="a"/>
|
---|
152 | <attribute name="b"/>
|
---|
153 | <sequential>
|
---|
154 | <echo>a@b or a@@b is @{a}@@@{b}</echo>
|
---|
155 | </sequential>
|
---|
156 | </macrodef>
|
---|
157 | <escape a="avalue" b="bvalue"/>
|
---|
158 | </target>
|
---|
159 |
|
---|
160 | <target name="attribute.description">
|
---|
161 | <macrodef name="d">
|
---|
162 | <attribute name="description"/>
|
---|
163 | <attribute name="d" default="p"/>
|
---|
164 | <sequential>
|
---|
165 | <echo>description is @{description}</echo>
|
---|
166 | </sequential>
|
---|
167 | </macrodef>
|
---|
168 | <d description="hello world"/>
|
---|
169 | </target>
|
---|
170 |
|
---|
171 | <target name="implicit">
|
---|
172 | <macrodef name="implicit">
|
---|
173 | <element name="implicit" implicit="yes"/>
|
---|
174 | <sequential>
|
---|
175 | <echo>Before implicit</echo>
|
---|
176 | <implicit/>
|
---|
177 | <echo>After implicit</echo>
|
---|
178 | </sequential>
|
---|
179 | </macrodef>
|
---|
180 |
|
---|
181 | <implicit>
|
---|
182 | <echo>In implicit</echo>
|
---|
183 | </implicit>
|
---|
184 | </target>
|
---|
185 |
|
---|
186 | <target name="implicit.notoptional">
|
---|
187 | <macrodef name="implicit">
|
---|
188 | <element name="implicit" implicit="yes"/>
|
---|
189 | <sequential>
|
---|
190 | <echo>Before implicit</echo>
|
---|
191 | <implicit/>
|
---|
192 | <echo>After implicit</echo>
|
---|
193 | </sequential>
|
---|
194 | </macrodef>
|
---|
195 |
|
---|
196 | <implicit>
|
---|
197 | </implicit>
|
---|
198 | </target>
|
---|
199 |
|
---|
200 | <target name="implicit.optional">
|
---|
201 | <macrodef name="implicit">
|
---|
202 | <element name="implicit" optional="yes" implicit="yes"/>
|
---|
203 | <sequential>
|
---|
204 | <echo>Before implicit</echo>
|
---|
205 | <implicit/>
|
---|
206 | <echo>After implicit</echo>
|
---|
207 | </sequential>
|
---|
208 | </macrodef>
|
---|
209 |
|
---|
210 | <implicit>
|
---|
211 | </implicit>
|
---|
212 | </target>
|
---|
213 |
|
---|
214 | <target name="implicit.explicit">
|
---|
215 | <macrodef name="implicit">
|
---|
216 | <element name="explicit" optional="yes"/>
|
---|
217 | <element name="implicit" optional="yes" implicit="yes"/>
|
---|
218 | <sequential>
|
---|
219 | <implicit/>
|
---|
220 | <explicit/>
|
---|
221 | </sequential>
|
---|
222 | </macrodef>
|
---|
223 | </target>
|
---|
224 |
|
---|
225 | <property name="default.override" value="old"/>
|
---|
226 | <macrodef name="simple.override">
|
---|
227 | <attribute name="attr" default="${default.override}"/>
|
---|
228 | <sequential>
|
---|
229 | <echo>value is @{attr}</echo>
|
---|
230 | </sequential>
|
---|
231 | </macrodef>
|
---|
232 |
|
---|
233 | <target name="override.default">
|
---|
234 | <antcall target="override.call">
|
---|
235 | <param name="default.override" value="new"/>
|
---|
236 | </antcall>
|
---|
237 | </target>
|
---|
238 |
|
---|
239 | <target name="override.call">
|
---|
240 | <simple.override/>
|
---|
241 | </target>
|
---|
242 |
|
---|
243 | </project>
|
---|