Browse Source

Document that Task.execute() can be invoked more than once.

Submitted by:	Rosen, Alex <arosen@silverstream.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268418 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
ffa6e24ba4
2 changed files with 11 additions and 4 deletions
  1. +5
    -1
      docs/index.html
  2. +6
    -3
      src/main/org/apache/tools/ant/Task.java

+ 5
- 1
docs/index.html View File

@@ -6205,7 +6205,11 @@ output.
<li>All attributes of all child elements get set via their corresponding
<code>setXXX</code> methods - at runtime.</li>

<li><code>execute()</code> is called at runtime.</li>
<li><code>execute()</code> 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 target1 and target2 both depend on target3, then running
"ant target1 target2" will run all tasks in target3 twice.</li>

</ol>
<h3>Example</h3>


+ 6
- 3
src/main/org/apache/tools/ant/Task.java View File

@@ -168,18 +168,21 @@ public abstract class Task {
}

/**
* Called by the project to let the task initialize properly. Normally it does nothing.
* Called by the project to let the task initialize properly.
*
* @throws BuildException if someting goes wrong with the build
*/
public void init() throws BuildException {}

/**
* Called by the project to let the task do it's work. Normally it does nothing.
* Called by the project to let the task do it's work. This method may be
* called more than once, if the task is invoked more than once. For example,
* if target1 and target2 both depend on target3, then running
* "ant target1 target2" will run all tasks in target3 twice.
*
* @throws BuildException if someting goes wrong with the build
*/
public void execute() throws BuildException {};
public void execute() throws BuildException {}

/**
* Returns the file location where this task was defined.


Loading…
Cancel
Save