ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: target-group in trunk
Date Thu, 10 Dec 2009 16:02:45 GMT
On 2009-12-10, Jeff Sinclair <> wrote:

> We've implemented a common build template which other groups at the
> firm build upon. One issue we have had is providing a simple way for
> our users to plug in custom logic without having to copy Target
> definitions. We went about this by providing macro hooks which people
> could override. For example if someone needed to do some custom code
> generation they could override the pre-compile macro hook.

> Would I be correct in thinking that target groups would be more
> suitable instead of the custom macro hooks we have?

I think so.

> If so are there any examples of Target groups I could look at?

Even though its been part of Ant's code base for a year now, it is not
even documented 8-(

There are a few test build files like

Basically you define a target-group where you want to create an
extension point

<target-group name="extension-point"/>

and people who want to have their targets run at the extension point add
their targets to this group

<target name="my-extension" target-group="extension-point">

> I am particularly interested in how I control whether or not my
> contributed Target is put at the beginning or end of a Target group.

You don't.

In your example above you'd have a pre-compile target-group that your
compile target depended on and the people with custom code generation
would add their targets to the pre-compile target-group.  If you need
more control over execution order, the depend attribute would resolve
that - or you might need even more target-groups.

> In terms of support for if/unless, this could be useful for common
> build templates such as ours. For example we may have some logic to
> build a web component that should not be invoked if the project is not
> a web project.

This is where the name target-group may be confusing.  The targets of a
target-group are not executed as part of that group but because the
target-group depends on them.  At least this is the concept we've
currently implemented.

> Will it be possible to contribute to target groups programmatically too?

Via ProjectHelpers or top-level tasks, yes.  Once the graph of targets
has been built, you can't modify the depends lists anymore.

> How do Target groups and their targets contribute to the -p option?

target-groups look exactly like a target.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message