You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Dale Anson <da...@germane-software.com> on 2003/09/02 21:33:30 UTC

Re: [VOTE] Ant/Antcall Returning properties and references [WAS] Re: ant 1.5.4 : Import

Dominique --

Dang, I didn't know there was a competition going on!

I wrote most of the Antelope tasks because I had a specific need. Feel 
free to grab what you want and put it in Ant-contrib. I like your 
"loophole" for your "antreturn" task, I didn't like the code reuse 
either, but the way the "ant" task was written didn't lend itself to 
extension, and I didn't see your loophole.

Really, the "call" task in Antelope does what many people seem to 
expect, and is a very minimal task with almost no overhead. Below is the 
complete source. Judging from the e-mail I get, most people are 
downloading the Antelope tasks for this "call" task, the 
"try/catch/finally" task, the "if/else" task, and the "post" task. 
Ant-contrib already has try/catch and if/else, but adding call and post 
(or equivalent) would be good.

Dale


Here's the "call" task source. It's very short, even with whitespace 
it's only 17 lines. "Call" is to replace "antcall", not "ant".

import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;

public class Call extends Task {
  
   private String target = null;
  
   public void setTarget(String target) {
      this.target = target; 
   }
  
   public void execute() {
      if (target == null)
         throw new BuildException("target is required");
      getProject().executeTarget(target);
   }
}

Dominique Devienne wrote:

>>-----Original Message-----
>>From: Stefan Bodewig [mailto:bodewig@apache.org]
>>
>>I'd like to explore the needs that is driving this specific feature
>>request - and see whether there is a different way to meet it.
>><import> or <include> will allow you to import a set of properties (or
>>property setting tasks) for example.
>>    
>>
>
>I probably would not have needed <antReturn> if I had access to <import>...
>I feel it's a little hackish too, even though it serves my purpose just
>fine for now. The fact that ProjectComponent reference instances change
>Project when returned could have negative side effects for example???
>
>  
>
>>>Three +1s are required for a code change, so, by the likes of it,
>>>the vote will have a negative result.
>>>      
>>>
>>No, just no positive result.
>>    
>>
>
>Sorry for dropping the ball on you ;-) I posted this code kinda showing off
>I guess, during the <import> discussion if you recall, and also because it
>might be useful to somebody else. I looked at the Antelope one, and really
>didn't like the code duplication I saw there. So I hacked my own thanks to a
>loop hope related to the Introspection rules of Ant to get a hold of the
>nested private project... Would be cleaner in <ant> proper, but still not
>great.
>
><import> is the way to go forward I think. I'm just missing it with my 1.5.3
>Ant used in production builds (augmented Ant, but not modified in any way).
>
>Thanks for proposing my code though. Cheers, --DD
>
>PS: Maybe Ant-Contrib would like to incorporate <antReturn>
>    to compete on features with Antelope??? ;-)
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org