source: release-kits/lirk3/resources/gs3-release-maker/ant/docs/manual/CoreTasks/antcall.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 6.5 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>AntCall Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="antcall">AntCall</a></h2>
12<h3>Description</h3>
13
14<p>Call another target within the same buildfile optionally
15specifying some properties (params in this context). <strong>This
16task must not be used outside of a <code>target</code>.</strong></p>
17
18<p>By default, all of the properties of the current project will be
19available in the new project. Alternatively, you can
20set the <i>inheritAll</i> attribute to <code>false</code> and only
21&quot;user&quot; properties (i.e., those passed on the command-line)
22will be passed to the new project. In either case, the set of
23properties passed to the new project will override the properties that
24are set in the new project (See also the <a href="property.html">property task</a>).</p>
25<p>You can also set properties in the new project from the old project
26by using nested param tags. These properties are always passed
27to the new project and any project created in that project
28regardless of the setting of <i>inheritAll</i>. This allows you to
29parameterize your subprojects. Properties defined on the command line
30can not be overridden by nested <code>&lt;param&gt;</code> elements.</p>
31
32<p>Nested <a href="#reference"><i><code>&lt;reference&gt</code>;</i></a> elements can
33be used to copy references from the calling project to the new
34project, optionally under a different id. References taken from
35nested elements will override existing references that have been
36defined outside of targets in the new project - but not those defined
37inside of targets.</p>
38
39<p>
40When a target is invoked by antcall, all of its dependent targets will
41also be called within the context of any new parameters. For example. if
42the target &quot;doSomethingElse&quot; depended on the target &quot;init&quot;, then the
43<i>antcall</i> of &quot;doSomethingElse&quot; will call &quot;init&quot; during the call.
44Of course, any properties defined in the antcall task or inherited from the calling target
45will be fixed and not overridable in the init task--or indeed in the &quot;doSomethingElse&quot; task.
46</p>
47
48<p>If the build file changes after you've started the build, the
49behavior of this task is undefined.</p>
50
51<h3>Parameters</h3>
52<table border="1" cellpadding="2" cellspacing="0">
53 <tr>
54 <td valign="top"><b>Attribute</b></td>
55 <td valign="top"><b>Description</b></td>
56 <td align="center" valign="top"><b>Required</b></td>
57 </tr>
58 <tr>
59 <td valign="top">target</td>
60 <td valign="top">The target to execute.</td>
61 <td valign="top" align="center">Yes</td>
62 </tr>
63 <tr>
64 <td valign="top">inheritAll</td>
65 <td valign="top">If <code>true</code>, pass all properties to the new Ant
66 project. Defaults to <code>true</code>.
67 </td>
68 <td align="center" valign="top">No</td>
69 </tr>
70 <tr>
71 <td valign="top">inheritRefs</td>
72 <td valign="top">If <code>true</code>, pass all references to the
73 new Ant project. Defaults to <code>false</code>.</td>
74 <td align="center" valign="top">No</td>
75 </tr>
76</table>
77
78<h3>Note on <code>inheritRefs</code></h3>
79
80<p><code>&lt;antcall&gt;</code> will not override existing references,
81even if you set <code>inheritRefs</code> to true. As the called build
82files is the same build file as the calling one, this means it will
83not override any reference set via an <code>id</code> attribute at
84all. The only references that can be inherited by the child project
85are those defined by nested <code>&lt;reference&gt;</code> elements or
86references defined by tasks directly (not using the <code>id</code>
87attribute).</p>
88
89<h3>Parameters specified as nested elements</h3>
90<h4>param</h4>
91<p>Specifies the properties to set before running the specified target. See <a
92href="property.html">property</a> for usage guidelines.<br/>
93These properties become equivalent to properties you define on
94the command line. These are special properties and they will always get passed
95down, even through additional <code>&lt;*ant*&gt;</code> tasks with inheritall set to
96false (see above).
97</p>
98
99<h4><a name="reference">reference</a></h4>
100<p>Used to choose references that shall be copied into the new project,
101optionally changing their id.</p>
102
103<table border="1" cellpadding="2" cellspacing="0">
104 <tr>
105 <td valign="top"><b>Attribute</b></td>
106 <td valign="top"><b>Description</b></td>
107 <td align="center" valign="top"><b>Required</b></td>
108 </tr>
109 <tr>
110 <td valign="top">refid</td>
111 <td valign="top">The id of the reference in the calling project.</td>
112 <td valign="top" align="center">Yes</td>
113 </tr>
114 <tr>
115 <td valign="top">torefid</td>
116 <td valign="top">The id of the reference in the new project.</td>
117 <td valign="top" align="center">No, defaults to the value of refid.</td>
118 </tr>
119</table>
120
121<h4>propertyset</h4>
122
123<p>You can specify a set of properties to be copied into the new
124project with <a
125href="../CoreTypes/propertyset.html">propertyset</a>s.</p>
126
127<p><em>since Ant 1.6</em>.</p>
128
129<h4>target</h4>
130
131<p>You can specify multiple targets using nested <code>&lt;target&gt;</code> elements
132instead of using the target attribute. These will be executed as if
133Ant had been invoked with a single target whose dependencies are the
134targets so specified, in the order specified.</p>
135<table border="1" cellpadding="2" cellspacing="0">
136 <tr>
137 <td valign="top"><b>Attribute</b></td>
138 <td valign="top"><b>Description</b></td>
139 <td align="center" valign="top"><b>Required</b></td>
140 </tr>
141 <tr>
142 <td valign="top">name</td>
143 <td valign="top">The name of the called target.</td>
144 <td valign="top" align="center">Yes</td>
145 </tr>
146</table>
147<p><em>since Ant 1.6.3</em>.</p>
148
149<h3>Examples</h3>
150<blockquote><pre>
151&lt;target name=&quot;default&quot;&gt;
152 &lt;antcall target=&quot;doSomethingElse&quot;&gt;
153 &lt;param name=&quot;param1&quot; value=&quot;value&quot;/&gt;
154 &lt;/antcall&gt;
155&lt;/target&gt;
156
157&lt;target name=&quot;doSomethingElse&quot;&gt;
158 &lt;echo message=&quot;param1=${param1}&quot;/&gt;
159&lt;/target&gt;
160</pre></blockquote>
161<p>Will run the target 'doSomethingElse' and echo 'param1=value'.</p>
162
163<blockquote><pre>
164&lt;antcall ... &gt;
165 &lt;reference refid=&quot;path1&quot; torefid=&quot;path2&quot;/&gt;
166&lt;/antcall&gt;
167</pre></blockquote>
168
169<p>will copy the parent's definition of <code>path1</code> into the
170new project using the id <code>path2</code>.</p>
171
172<hr><p align="center">Copyright &copy; 2000-2005 The Apache Software Foundation. All rights
173Reserved.</p>
174
175</body>
176</html>
Note: See TracBrowser for help on using the repository browser.