ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <jalbe...@cellectivity.com>
Subject RE: Internal AntCall and references
Date Wed, 15 Dec 2004 10:36:36 GMT
> From: Yves Martin [mailto:yves.martin@elca.ch] 
> 
> 
> Stefan Bodewig <bodewig@apache.org> writes:
> 
> > On Mon, 13 Dec 2004, Yves Martin <yves.martin@elca.ch> wrote:
> >
> >>  To clean it, I decided to use project references but it does not  
> >> work with 'antcall':
> >
> > This is because you set the reference in a different 
> Project instance 
> > than you try to read it in.
> >
> >>  target A
> >>    antcall B
> >>    MyTask{getReference X}
> >> 
> >>  target B
> >>    MyTask{setReference X}
> >> 
> >>  Is there a better way to implement a global storage ?
> >
> > Option (1) don't use antcall at all.
> 
>  I think it is impossible. My target A looks like to:
> 
>    target A
>      Job before
>      Loop { antcall B }
>      MyTask{getReference X}
> 

You may want to take a look at the <for/> task in antcontrib
which uses a <macro> for the content of the loop.

>  What I may do is to create my own 'call' task that calls a 
> target in the same  project (as depends attribute does I 
> guess). Is it a good idea ?
> 
> > Option (2) use a Map as your global storage and set this one as 
> > reference before invoking antcall (with inheritrefs=true) and have 
> > MyTask not set the reference in the project, but add it to 
> your global 
> > storage.
> 
>  I will try that also.
> 
> > This also requires you Map to be not Cloneable since 
> otherwise B will 
> > only see a copy of your global storage and be unable to 
> write to it. 
> > Ant tries its best to make it hard for "subbuilds" to affect their 
> > "parent build".
> 
>  Yes, I understand that perfectly.
> 
>  Regards
> -- 
> Yves Martin
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message