You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jeffrey E Care <ca...@us.ibm.com> on 2007/11/02 19:48:47 UTC

Optional target support?

I've been trying to remember: is there any support for optional targets?

The scenario is that I have a very large tree, with many (i.e. several 
hundred) subprojects; I want to run a certain target (let's call it "foo") 
on each project that defines the target, but I don't have a good way of 
knowing which projects actually define the "foo" target.

I'm pretty sure that I could satisfy this requirement with a custom 
executor (i.e. just skip the target if it's not defined), but I was 
racking my brain to make sure that there isn't already something like this 
in 1.6.5; does anybody know?

____________________________________________________________________________________________ 

Jeffrey E. (Jeff) Care 
carej@us.ibm.com 
IBM WebSphere Application Server 
Systems Management Tools Development 





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


Re: Optional target support?

Posted by Dominique Devienne <dd...@gmail.com>.
On 11/6/07, Steve Loughran <st...@apache.org> wrote:
> 2. I'd also like to give subant the ability to set the basedir, the way
> <ant> does

I always thought this was a mistake personally. Each build should be
in charge here, and if you want to coordinate builds to share a common
dir, pass a property down the sub-build tree. One easy way to do this
would be the ability to set a *user* property from within a build,
which  is always propagated down. --DD

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


Re: Optional target support?

Posted by Jeffrey E Care <ca...@us.ibm.com>.
Steve Loughran <st...@apache.org> wrote on 11/06/2007 07:13:55 AM:

> you cant control common import files once you also include third party 
> projects into your build tree and use ivy to choreograph it.
> 
> For the new executor I'm doing for smartfrog, I looked at <subant> and 
> decided to change it to make targets optional.
> 
> 1. we could add this to subant "skipmissingtargets"
> 2. I'd also like to give subant the ability to set the basedir, the way 
> <ant> does

I ended up writing a custom executor that can skip optional targets if 
they don't exist; the optional targets have to be called out specifically 
in a property. Currently it only works for targets passed on the command 
line, as the project toposort code will still choke on missing targets 
when processing target dependencies. I'll have to write a custom toposort 
method to handle the latter case.

Thanks to everyone for their input.

____________________________________________________________________________________________ 

Jeffrey E. (Jeff) Care 
carej@us.ibm.com 
IBM WebSphere Application Server 
Systems Management Tools Development 





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


Re: Optional target support?

Posted by Steve Loughran <st...@apache.org>.
Jeffrey E Care wrote:
> "Peter Reilly" <pe...@gmail.com> wrote on 11/02/2007 02:54:38 
> PM:
> 
>> The easy way is to have a common.xml that is included in
>> by each subproject. The common.xml would have a "foo"
>> target with an empty implementation.
>>
>> <target name="foo"/>
>>
>> Any sub project could then have there own "foo" target that
>> would override the imported one.
> 
> Thanks Peter. That occurred to me as well; unfortunately, I can't sell 
> retrofitting hundreds of build.xml files in order to make this optional 
> target stuff happen.
> 
> Going forward you're absolutely right: all the subprojects should be using 
> a common import & we plan to do that in a future release; the main issue 
> is that these subprojects predate import support & the sheer volume of 
> them means that a retrofitting effort will take too long and introduce too 
> much risk to an effort that the bosses want done yesterday...


you cant control common import files once you also include third party 
projects into your build tree and use ivy to choreograph it.

For the new executor I'm doing for smartfrog, I looked at <subant> and 
decided to change it to make targets optional.

1. we could add this to subant "skipmissingtargets"
2. I'd also like to give subant the ability to set the basedir, the way 
<ant> does


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


Re: Optional target support?

Posted by Vijay Aravamudhan <av...@gmail.com>.
would the <subant/> task help at all?

Vijay

Jeffrey E Care wrote:
> "Peter Reilly" <pe...@gmail.com> wrote on 11/02/2007 02:54:38 
> PM:
>
>   
>> The easy way is to have a common.xml that is included in
>> by each subproject. The common.xml would have a "foo"
>> target with an empty implementation.
>>
>> <target name="foo"/>
>>
>> Any sub project could then have there own "foo" target that
>> would override the imported one.
>>     
>
> Thanks Peter. That occurred to me as well; unfortunately, I can't sell 
> retrofitting hundreds of build.xml files in order to make this optional 
> target stuff happen.
>
> Going forward you're absolutely right: all the subprojects should be using 
> a common import & we plan to do that in a future release; the main issue 
> is that these subprojects predate import support & the sheer volume of 
> them means that a retrofitting effort will take too long and introduce too 
> much risk to an effort that the bosses want done yesterday...
>
> ____________________________________________________________________________________________ 
>
> Jeffrey E. (Jeff) Care 
> carej@us.ibm.com 
> IBM WebSphere Application Server 
> Systems Management Tools Development 
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>   

Re: Optional target support?

Posted by Jeffrey E Care <ca...@us.ibm.com>.
"Peter Reilly" <pe...@gmail.com> wrote on 11/02/2007 02:54:38 
PM:

> The easy way is to have a common.xml that is included in
> by each subproject. The common.xml would have a "foo"
> target with an empty implementation.
> 
> <target name="foo"/>
> 
> Any sub project could then have there own "foo" target that
> would override the imported one.

Thanks Peter. That occurred to me as well; unfortunately, I can't sell 
retrofitting hundreds of build.xml files in order to make this optional 
target stuff happen.

Going forward you're absolutely right: all the subprojects should be using 
a common import & we plan to do that in a future release; the main issue 
is that these subprojects predate import support & the sheer volume of 
them means that a retrofitting effort will take too long and introduce too 
much risk to an effort that the bosses want done yesterday...

____________________________________________________________________________________________ 

Jeffrey E. (Jeff) Care 
carej@us.ibm.com 
IBM WebSphere Application Server 
Systems Management Tools Development 





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


Re: Optional target support?

Posted by Peter Reilly <pe...@gmail.com>.
The easy way is to have a common.xml that is included in
by each subproject. The common.xml would have a "foo"
target with an empty implementation.

<target name="foo"/>

Any sub project could then have there own "foo" target that
would override the imported one.

Peter

On 11/2/07, Jeffrey E Care <ca...@us.ibm.com> wrote:
> I've been trying to remember: is there any support for optional targets?
>
> The scenario is that I have a very large tree, with many (i.e. several
> hundred) subprojects; I want to run a certain target (let's call it "foo")
> on each project that defines the target, but I don't have a good way of
> knowing which projects actually define the "foo" target.
>
> I'm pretty sure that I could satisfy this requirement with a custom
> executor (i.e. just skip the target if it's not defined), but I was
> racking my brain to make sure that there isn't already something like this
> in 1.6.5; does anybody know?
>
> ____________________________________________________________________________________________
>
> Jeffrey E. (Jeff) Care
> carej@us.ibm.com
> IBM WebSphere Application Server
> Systems Management Tools Development
>
>
>
>
>
> ---------------------------------------------------------------------
> 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