ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vasco Lemoine <vasco.lemo...@imc.nl>
Subject Re: Ivy triggers and scope of properties
Date Mon, 21 Jan 2008 09:35:18 GMT
On Fri, 2008-01-18 at 17:09 +0100, Xavier Hanin wrote:
> On Jan 17, 2008 4:43 PM, Vasco Lemoine <vasco.lemoine@imc.nl> wrote:
> 
> > Hi,
> >
> > I'm struggling with a problem concerning ivy triggers. What I want to is
> > the following. As a in a pre-resolve trigger i want to concatenate the
> > module that are resolve (transitively).
> >
> > this is in my ivy-setting.xml
> >
> > <triggers>
> >        <ant-call target="ivy-pre-resolve-dependency" prefix="dep"
> >                  event="pre-resolve-dependency" />
> > </triggers>
> >
> > this is in my build file:
> >
> > <property name="foo" value="" />
> >
> > <target name="ivy-pre-resolve-dependency">
> > <echo>foo=${foo}</echo>
> > <var name="bar" value="${foo}"/>
> > <echo>bar=${bar}</echo>
> > <if>
> > <length string="${bar}"when="greater"length="0" />
> > <then>
> >  <var name="bar"value="${bar},{dep.module}" />
> > </then>
> > <else>
> >  <var name="bar" value="${dep.module}" />
> > </else>
> > </if>
> > <propertycopy name="foo" from="bar" override="true"/>
> > <echo>
> >  module=${dep.module}
> >  bar=${bar}
> >  foo=${foo}
> > </echo>
> > </target>
> >
> >
> >
> > output is:(having declared dependency: this->module1->module2)
> >
> > foo=
> > bar=
> > module=module1
> > bar=module1
> > foo=module1
> >
> > foo=
> > bar=
> > module=module2
> > bar=module2
> > foo=module2
> >
> > instead of:
> >
> > foo=
> > bar=
> > module=module1
> > bar=module1
> > foo=module1
> >
> > foo=module1
> > bar=module1
> > module=module2
> > bar=module1,module2
> > foo=module1,module2
> >
> > Is there some way of getting variables or properties to the scope from
> > which the trigger was generated.
> 
> I'm a bit surprised by the result, but I don't know the var and propertycopy
> task well enough, and it may be related to what they do.
Well i dug into the code and it looks like when the Resolve task, and
any task in particular, a copy of the context is pushed onto a stack and
used. This explains the behavior.
>  Did you try to
> simulate the Ivy triggers in a pure Ant script (without Ivy) to see what
> happens:
> <target name="test">
>   <antcall target="foo">
>     <param name="dep.module" value="module1"/>
>   </antcall>
>   <antcall target="foo">
>     <param name="dep.module" value="module2"/>
>   </antcall>
> </target>
> 
> If this works, then it's Ivy that doesn't do what expected. If it doesn't,
> then Ivy has nothing to do with your problem, and you should look for
> another solution, like using a script or a custom Ant task (in Java) and a
> true variable (which would BTW make things much more readable IMHO).
> 
> Xavier
> 
> >
> >
> > By the way the var and propertycopy are from the antcontrib library.
> >
> > Thanx Vasco
> >
> >
> >
> >
> >
> 
> 


Mime
View raw message