ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Tewksbury" <te...@adhesive.com>
Subject RE: Persistence of Property
Date Wed, 25 Oct 2000 19:53:44 GMT
Thanks for the answer.

So taking this a little bit further.  I take it that there is no way of
promulgating props (that are set in other xml files) up the project path?
For instance, when calling submodule builds. (Not through an antcall but
just an ant task).

-----Original Message-----
From: Jose Alberto Fernandez [mailto:JFernandez@viquity.com]
Sent: Wednesday, October 25, 2000 1:55 PM
To: 'ant-dev@jakarta.apache.org'
Subject: RE: Persistence of Property


Well, I do not think we can call it "by design", I would say
it is a feature. The issue to keep in mind here is that
<antcall> does not execute on the same "context" as the caller.
It is actually calling the execution of a different project that
just happens to be the same as the one we are executing.

This means that the properties defined during its execution will be reset
at the end on the <antcall>, and hence the funny behaviour.

The following targets will produce your expected output:

<target name="main" depends="pre,dosomething" >
	<echo message="Ending Main:${test.prop}" />
</target>

<target name="pre">
	<echo message="Starting main:${test.prop}" />
</target>

<target name="dosomething">
	<property name="test.prop" value="isSet" />
	<echo message="in dosomething:${test.prop}" />
</target>


> From: Charles Tewksbury [mailto:tewks@adhesive.com]
>
> Question about the property tag and release 1.2.
>
> From "What's New"; it states:${} expansion now happens at runtime and
> <property> tags
> living inside of targets only take effect if they are visited at
> runtime.
>
> Does this property get set to a "project level"  For instance:
>
> <target name="main">
> 	<echo message="Starting main:${test.prop}" />
> 	<antcall target="dosomething" />
> 	<echo message="Ending Main:${test.prop}" />
> </target>
>
> <target name="dosomething">
> 	<proprty name="test.prop" value="isSet" />
> 	<echo message="in dosomething:${test.prop}" />
> </target>
>
> produces the following output:
> 	main:
> 	Starting main:${test.prop}
>
> 	dosomething:
> 	in dosomething:isSet
> 	Ending Main${test.prop}
>
> It seems to me, that once the property is set, it should
> remain set until
> the Project is done.  Is what is happening currently a bug or
> by design?
>
>  - Charles Tewksbury
>


Mime
View raw message