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
|
---|
31 | specifying some properties (params in this context). <strong>This
|
---|
32 | task 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
|
---|
35 | available in the new project. Alternatively, you can
|
---|
36 | set the <i>inheritAll</i> attribute to <code>false</code> and only
|
---|
37 | "user" properties (i.e., those passed on the command-line)
|
---|
38 | will be passed to the new project. In either case, the set of
|
---|
39 | properties passed to the new project will override the properties that
|
---|
40 | are 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
|
---|
42 | by using nested param tags. These properties are always passed
|
---|
43 | to the new project and any project created in that project
|
---|
44 | regardless of the setting of <i>inheritAll</i>. This allows you to
|
---|
45 | parameterize your subprojects. Properties defined on the command line
|
---|
46 | can not be overridden by nested <code><param></code> elements.</p>
|
---|
47 |
|
---|
48 | <p>Nested <a href="#reference"><i><code><reference></code>;</i></a> elements can
|
---|
49 | be used to copy references from the calling project to the new
|
---|
50 | project, optionally under a different id. References taken from
|
---|
51 | nested elements will override existing references that have been
|
---|
52 | defined outside of targets in the new project - but not those defined
|
---|
53 | inside of targets.</p>
|
---|
54 |
|
---|
55 | <p>
|
---|
56 | When a target is invoked by antcall, all of its dependent targets will
|
---|
57 | also be called within the context of any new parameters. For example. if
|
---|
58 | the target "doSomethingElse" depended on the target "init", then the
|
---|
59 | <i>antcall</i> of "doSomethingElse" will call "init" during the call.
|
---|
60 | Of course, any properties defined in the antcall task or inherited from the calling target
|
---|
61 | will be fixed and not overridable in the init task--or indeed in the "doSomethingElse" task.
|
---|
62 | </p>
|
---|
63 |
|
---|
64 | <p>If the build file changes after you've started the build, the
|
---|
65 | behavior 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><antcall></code> will not override existing references,
|
---|
97 | even if you set <code>inheritRefs</code> to true. As the called build
|
---|
98 | files is the same build file as the calling one, this means it will
|
---|
99 | not override any reference set via an <code>id</code> attribute at
|
---|
100 | all. The only references that can be inherited by the child project
|
---|
101 | are those defined by nested <code><reference></code> elements or
|
---|
102 | references defined by tasks directly (not using the <code>id</code>
|
---|
103 | attribute).</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
|
---|
108 | href="property.html">property</a> for usage guidelines.<br>
|
---|
109 | These properties become equivalent to properties you define on
|
---|
110 | the command line. These are special properties and they will always get passed
|
---|
111 | down, even through additional <code><*ant*></code> tasks with inheritall set to
|
---|
112 | false (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,
|
---|
117 | optionally 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
|
---|
140 | project with <a
|
---|
141 | href="../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><target></code> elements
|
---|
148 | instead of using the target attribute. These will be executed as if
|
---|
149 | Ant had been invoked with a single target whose dependencies are the
|
---|
150 | targets 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 | <target name="default">
|
---|
168 | <antcall target="doSomethingElse">
|
---|
169 | <param name="param1" value="value"/>
|
---|
170 | </antcall>
|
---|
171 | </target>
|
---|
172 |
|
---|
173 | <target name="doSomethingElse">
|
---|
174 | <echo message="param1=${param1}"/>
|
---|
175 | </target>
|
---|
176 | </pre></blockquote>
|
---|
177 | <p>Will run the target 'doSomethingElse' and echo 'param1=value'.</p>
|
---|
178 |
|
---|
179 | <blockquote><pre>
|
---|
180 | <antcall ... >
|
---|
181 | <reference refid="path1" torefid="path2"/>
|
---|
182 | </antcall>
|
---|
183 | </pre></blockquote>
|
---|
184 |
|
---|
185 | <p>will copy the parent's definition of <code>path1</code> into the
|
---|
186 | new project using the id <code>path2</code>.</p>
|
---|
187 |
|
---|
188 |
|
---|
189 |
|
---|
190 | </body>
|
---|
191 | </html>
|
---|