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