|
|
@@ -76,9 +76,18 @@ good convention, though.</p> |
|
|
|
|
|
|
|
<h3>The Life-cycle of a Task</h3> |
|
|
|
<ol> |
|
|
|
<li>The task gets instantiated using a no-argument constructor, at parser |
|
|
|
time. This means even tasks that are never executed get |
|
|
|
instantiated.</li> |
|
|
|
<li> |
|
|
|
The xml element that contains the tag corresponding to the |
|
|
|
task gets converted to an UnknownElement at parser time. |
|
|
|
This UnknownElement gets placed in a list within a target |
|
|
|
object, or recursivly within another UnknownElement. |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
When the target is executed, each UnknownElement is invoked |
|
|
|
using an <code>perform()</code> method. This instantiates |
|
|
|
the task. This means that tasks only gets |
|
|
|
instantiated at run time. |
|
|
|
</li> |
|
|
|
|
|
|
|
<li>The task gets references to its project and location inside the |
|
|
|
buildfile via its inherited <code>project</code> and |
|
|
@@ -86,18 +95,18 @@ good convention, though.</p> |
|
|
|
|
|
|
|
<li>If the user specified an <code>id</code> attribute to this task, |
|
|
|
the project |
|
|
|
registers a reference to this newly created task, at parser |
|
|
|
registers a reference to this newly created task, at run |
|
|
|
time.</li> |
|
|
|
|
|
|
|
<li>The task gets a reference to the target it belongs to via its |
|
|
|
inherited <code>target</code> variable.</li> |
|
|
|
|
|
|
|
<li><code>init()</code> is called at parser time.</li> |
|
|
|
<li><code>init()</code> is called at run time.</li> |
|
|
|
|
|
|
|
<li>All child elements of the XML element corresponding to this task |
|
|
|
are created via this task's <code>createXXX()</code> methods or |
|
|
|
instantiated and added to this task via its <code>addXXX()</code> |
|
|
|
methods, at parser time.</li> |
|
|
|
methods, at run time.</li> |
|
|
|
|
|
|
|
<li>All attributes of this task get set via their corresponding |
|
|
|
<code>setXXX</code> methods, at runtime.</li> |
|
|
@@ -109,10 +118,8 @@ good convention, though.</p> |
|
|
|
<li>All attributes of all child elements get set via their corresponding |
|
|
|
<code>setXXX</code> methods, at runtime.</li> |
|
|
|
|
|
|
|
<li><a name="execute"><code>execute()</code></a> is called at runtime. While the above initialization |
|
|
|
steps only occur once, the execute() method may be |
|
|
|
called more than once, if the task is invoked more than once. For example, |
|
|
|
if <code>target1</code> and <code>target2</code> both depend |
|
|
|
<li><a name="execute"><code>execute()</code></a> is called at runtime. |
|
|
|
If <code>target1</code> and <code>target2</code> both depend |
|
|
|
on <code>target3</code>, then running |
|
|
|
<code>'ant target1 target2'</code> will run all tasks in |
|
|
|
<code>target3</code> twice.</li> |
|
|
|