Tiny patch to enable Recursion in Ant

2008-05-11 Thread Colm Smyth
Hi,

I wanted to be able to easily write recursive Ant build files, so I
developed a macro and a small patch to Ant. I'd like the advice of the
dev list as to if and how I should submit this patch for inclusion in
Ant.

The patch (roughly 30 extra lines of code across 6 files) adds two new
*dynamic* properties to Ant:
 1) ant.project.target - the default target of the current project
 2) ant.current.target - a comma-separated list of the actual targets
that were invoked on the current project

These properties are updated automatically, similar to ant.file or
ant.project.name.

The "recurse" macro uses the antcontrib:for task to iterate over
multiple targets (the antcontrib jar required the "for" task to be
added to its properties). The macro can accept an explicit list of
targets, but I also wanted to be able to recurse on the targets that
were actually invoked.

Here's how you would use it:

 
 

 
 

 
 

Alternatively:
 
 

My Ant experience is limited, so I may have overlooked an existing way
to achieve this, but reading and searching suggests that others are
still missing recursion in Ant. I look forward to your advice!

 All the best,
 Colm.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tiny patch to enable Recursion in Ant

2008-05-14 Thread Colm Smyth
Yes I used subant, but as I said, it can't recurse on the current target.

Since recursion should be a core function of a hierarchical build
system, I think this patch is worth adding to Ant.

2008/5/14 Stefan Bodewig <[EMAIL PROTECTED]>:
> On Sun, 11 May 2008, Colm Smyth <[EMAIL PROTECTED]> wrote:
>
>  > My Ant experience is limited, so I may have overlooked an existing
>  > way to achieve this, but reading and searching suggests that others
>  > are still missing recursion in Ant. I look forward to your advice!
>
>  Apart from the ability to recurse for the current target, 
>  should be able to do what you need.  Your changes might be able to
>  enable the "recurse using the current target" use-case for subant as
>  well.
>
>  Stefan
>
>  -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tiny patch to enable Recursion in Ant

2008-05-28 Thread Colm Smyth
It's nice to see some feedback and new ideas; would anybody like to
comment on what I actually did? ;)

See https://issues.apache.org/bugzilla/show_bug.cgi?id=44980 for the
issue I raised almost immediately after posting a request for
comments.

2008/5/28 Steve Loughran <[EMAIL PROTECTED]>:
> Stefan Bodewig wrote:
>>
>> sorry for the delay, a combination of a whole lot of work, a broken
>> iBook, very nice weather and severe back pain (not necessarily in that
>> order) have kept me offline.
>>
>> On Wed, 14 May 2008, Colm Smyth <[EMAIL PROTECTED]> wrote:
>>
>>> Yes I used subant, but as I said, it can't recurse on the current
>>> target.
>>>
>>> Since recursion should be a core function of a hierarchical build
>>> system, I think this patch is worth adding to Ant.
>>
>> First of all your original mail didn't contain the patch itself.
>>
>> Second you said you used ant-contrib's for and I pointed out that
>> subant should be enough.  The only thing that's missing is a property
>> that knows the current target, isn't it?
>>
>> I know we have rejected the idea of such a property in the past, but
>> we may be at a different point today, so if you open an enhancement
>> request for such a property (or find the old one and reopen it), that
>> would e the right place to attach a patch to enable it.
>
> I could imagine a task to set a property to the current target
>
> 
>
> ...maybe even something for a complete stack trace/list of imports that is
> live
>
> --
> Steve Loughran  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action   http://antbook.org/
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Adding magic properties for targets?

2008-06-06 Thread Colm Smyth
Thanks for accepting the patch.

2008/6/4 Dominique Devienne <[EMAIL PROTECTED]>:
> On Wed, Jun 4, 2008 at 5:17 AM, Stefan Bodewig <[EMAIL PROTECTED]> wrote:
>> I'd rather not set ant.project.default-target at all if there is no default 
>> target.
>
> +1
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]