Stan,
The following is from my ANT file.
<target name="init">
<property environment="env" />
<property name="isdefined" value="${env.VARNAME}"/>
<condition property="isdefined" value="default">
<equals arg1="${server}" arg2="" />
</condition>
<echo message="${server}" />
</target>
When ANT 1.4.1 is run the following is displayed
${env.VARNAME}
I would have expected an empty string to be displayed.
I am basically trying to set up properties in init
based on environment variables.
What I am trying to do is set up the build environment
based on OS environment variables. I get the value of
the variable and invoke <antcall target="${isdefined}"
/>
This way I can have handlers that are specific to the
build. The next problem that I ran into is that the
called task appears to be unable to pass back
properties to the properties.
What does the "." at the end of the environment
variable indicate ? It was unclear to me from the
docs.
Thanks.
- viraf
--- Stan Rosenberg <[EMAIL PROTECTED]> wrote:
> Viraf,
>
> What version of Ant are you running? Please, make
> sure that the environment
> variable you are
> trying to 'echo' is really contained in the
> environment and maybe remove the
> dot in <property environment="env." /> so that it
> reads <property
> environment="env" />
>
> I tested this on Ant 1.4.1, and it works fine.
>
> Cheers,
>
> Stan
>
> -----Original Message-----
> From: Viraf Bankwalla
> [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 27, 2002 12:22 AM
> To: [EMAIL PROTECTED]
> Subject: Environment Property
>
>
> Hi,
>
> How do I test for the existence of an environment
> variable ? How do I take an action if a the
> variable
> is defined ?
>
> I assumed that:
>
> <property environment="env." />
> <property name="isdefined" value="${env.VARNAME}"
> />
> <echo message="isdefined: ${isdefined}" />
>
> would disply
>
> isdefined:
>
> however it displays
>
> isdefined: ${env.VARNAME}
>
> If this is not the desired behaviour, the fix lies
> in
> ProjectHelper::replaceProperties.
>
> fragment = (keys.containsKey(propertyName)) ?
> (String) keys.get(propertyName)
> : "${" + propertyName + "}";
>
>
> Thanks.
>
> - viraf
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>