source: release-kits/lirk3/bin/ant-installer/web/manual1.6.2/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: 5.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 build-file optionally
15specifying some properties (param's in this context). <strong>This
16task must no 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 &lt;param&gt; elements.</p>
31
32<p>Nested <a href="#reference"><i>&lt;reference&gt;</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.</p>
93
94<a name="reference"></a><h4>reference</h4>
95<p>Used to choose references that shall be copied into the new project,
96optionally changing their id.</p>
97
98<table border="1" cellpadding="2" cellspacing="0">
99 <tr>
100 <td valign="top"><b>Attribute</b></td>
101 <td valign="top"><b>Description</b></td>
102 <td align="center" valign="top"><b>Required</b></td>
103 </tr>
104 <tr>
105 <td valign="top">refid</td>
106 <td valign="top">The id of the reference in the calling project.</td>
107 <td valign="top" align="center">Yes</td>
108 </tr>
109 <tr>
110 <td valign="top">torefid</td>
111 <td valign="top">The id of the reference in the new project.</td>
112 <td valign="top" align="center">No, defaults to the value of refid.</td>
113 </tr>
114</table>
115
116<h4>propertyset</h4>
117
118<p>You can specify a set of properties to be copied into the new
119project with <a
120href="../CoreTypes/propertyset.html">propertyset</a>s.</p>
121
122<p><em>since Ant 1.6</em>.</p>
123
124<h3>Examples</h3>
125<pre>
126 &lt;target name=&quot;default&quot;&gt;
127 &lt;antcall target=&quot;doSomethingElse&quot;&gt;
128 &lt;param name=&quot;param1&quot; value=&quot;value&quot;/&gt;
129 &lt;/antcall&gt;
130 &lt;/target&gt;
131
132 &lt;target name=&quot;doSomethingElse&quot;&gt;
133 &lt;echo message=&quot;param1=${param1}&quot;/&gt;
134 &lt;/target&gt;
135</pre>
136<p>Will run the target 'doSomethingElse' and echo 'param1=value'.</p>
137
138<pre>
139 &lt;antcall ... &gt;
140 &lt;reference refid=&quot;path1&quot; torefid=&quot;path2&quot;/&gt;
141 &lt;/antcall&gt;
142</pre>
143
144<p>will copy the parent's definition of <code>path1</code> into the
145new project using the id <code>path2</code>.</p>
146
147<hr><p align="center">Copyright &copy; 2000-2004 The Apache Software Foundation. All rights
148Reserved.</p>
149
150</body>
151</html>
Note: See TracBrowser for help on using the repository browser.