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
|
---|
15 | specifying some properties (param's in this context). <strong>This
|
---|
16 | task 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
|
---|
19 | available in the new project. Alternatively, you can
|
---|
20 | set the <i>inheritAll</i> attribute to <code>false</code> and only
|
---|
21 | "user" properties (i.e., those passed on the command-line)
|
---|
22 | will be passed to the new project. In either case, the set of
|
---|
23 | properties passed to the new project will override the properties that
|
---|
24 | are 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
|
---|
26 | by using nested param tags. These properties are always passed
|
---|
27 | to the new project and any project created in that project
|
---|
28 | regardless of the setting of <i>inheritAll</i>. This allows you to
|
---|
29 | parameterize your subprojects. Properties defined on the command line
|
---|
30 | can not be overridden by nested <param> elements.</p>
|
---|
31 |
|
---|
32 | <p>Nested <a href="#reference"><i><reference></i></a> elements can
|
---|
33 | be used to copy references from the calling project to the new
|
---|
34 | project, optionally under a different id. References taken from
|
---|
35 | nested elements will override existing references that have been
|
---|
36 | defined outside of targets in the new project - but not those defined
|
---|
37 | inside of targets.</p>
|
---|
38 |
|
---|
39 | <p>
|
---|
40 | When a target is invoked by antcall, all of its dependent targets will
|
---|
41 | also be called within the context of any new parameters. For example. if
|
---|
42 | the target "doSomethingElse" depended on the target "init", then the
|
---|
43 | <i>antcall</i> of "doSomethingElse" will call "init" during the call.
|
---|
44 | Of course, any properties defined in the antcall task or inherited from the calling target
|
---|
45 | will be fixed and not overridable in the init task -or indeed in the "doSomethingElse" task.
|
---|
46 | </p>
|
---|
47 |
|
---|
48 | <p>If the build file changes after you've started the build, the
|
---|
49 | behavior 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><antcall></code> will not override existing references,
|
---|
81 | even if you set <code>inheritRefs</code> to true. As the called build
|
---|
82 | files is the same build file as the calling one, this means it will
|
---|
83 | not override any reference set via an <code>id</code> attribute at
|
---|
84 | all. The only references that can be inherited by the child project
|
---|
85 | are those defined by nested <code><reference></code> elements or
|
---|
86 | references defined by tasks directly (not using the <code>id</code>
|
---|
87 | attribute).</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
|
---|
92 | href="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,
|
---|
96 | optionally 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
|
---|
119 | project with <a
|
---|
120 | href="../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 | <target name="default">
|
---|
127 | <antcall target="doSomethingElse">
|
---|
128 | <param name="param1" value="value"/>
|
---|
129 | </antcall>
|
---|
130 | </target>
|
---|
131 |
|
---|
132 | <target name="doSomethingElse">
|
---|
133 | <echo message="param1=${param1}"/>
|
---|
134 | </target>
|
---|
135 | </pre>
|
---|
136 | <p>Will run the target 'doSomethingElse' and echo 'param1=value'.</p>
|
---|
137 |
|
---|
138 | <pre>
|
---|
139 | <antcall ... >
|
---|
140 | <reference refid="path1" torefid="path2"/>
|
---|
141 | </antcall>
|
---|
142 | </pre>
|
---|
143 |
|
---|
144 | <p>will copy the parent's definition of <code>path1</code> into the
|
---|
145 | new project using the id <code>path2</code>.</p>
|
---|
146 |
|
---|
147 | <hr><p align="center">Copyright © 2000-2004 The Apache Software Foundation. All rights
|
---|
148 | Reserved.</p>
|
---|
149 |
|
---|
150 | </body>
|
---|
151 | </html>
|
---|