You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2001/01/08 17:51:35 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant Task.java

bodewig     01/01/08 08:51:35

  Modified:    docs     index.html
               src/main/org/apache/tools/ant Task.java
  Log:
  Document that Task.execute() can be invoked more than once.
  
  Submitted by:	Rosen, Alex <ar...@silverstream.com>
  
  Revision  Changes    Path
  1.181     +6 -2      jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.180
  retrieving revision 1.181
  diff -u -r1.180 -r1.181
  --- index.html	2001/01/08 12:42:46	1.180
  +++ index.html	2001/01/08 16:51:29	1.181
  @@ -29,7 +29,7 @@
   </ul>
   
   <p>Version: @VERSION@</p>
  -<p>$Id: index.html,v 1.180 2001/01/08 12:42:46 bodewig Exp $</p>
  +<p>$Id: index.html,v 1.181 2001/01/08 16:51:29 bodewig Exp $</p>
   
   <hr>
   <h2>Table of Contents</h2>
  @@ -6205,7 +6205,11 @@
     <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>
  
  
  
  1.17      +6 -3      jakarta-ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Task.java	2001/01/03 14:18:27	1.16
  +++ Task.java	2001/01/08 16:51:34	1.17
  @@ -168,18 +168,21 @@
       }
   
       /**
  -     * 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.
  
  
  

Re: cvs commit: jakarta-ant/src/main/org/apache/tools/antTask.java

Posted by Peter Donald <do...@apache.org>.
At 09:49  11/1/01 -0800, James Duncan Davidson wrote:
>On 1/8/01 8:51 AM, "bodewig@apache.org" <bo...@apache.org> wrote:
>
>> -  <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>
>
>I guess this is really a legacy of how the current tree is formed. For Ant
>2.0, with late binding of all property values and late creation of the
>actual TaskActions, this wouldn't necessarily be the case.

I am not sure Ant2.0 will actually allow manipulation of instances in this
manner thou ? Or do you see it as desirable?
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant Task.java

Posted by James Duncan Davidson <du...@x180.net>.
On 1/8/01 8:51 AM, "bodewig@apache.org" <bo...@apache.org> wrote:

> -  <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>

I guess this is really a legacy of how the current tree is formed. For Ant
2.0, with late binding of all property values and late creation of the
actual TaskActions, this wouldn't necessarily be the case.

.duncan

-- 
James Duncan Davidson                                        duncan@x180.net
                                                                  !try; do()