You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dan MacKay <da...@kingston.hummingbird.com> on 2000/10/10 21:43:14 UTC

Environment variables

Hi all,

I am a relative new user to ant and have the following question. Is it
possible to manipulate DOS session environment variables from inside of ant.
The problem I am having is setting up MS Source Safe environment variable
SSDIR. This is would be to enable me to hand in the SS database that I
wished to use for for a build as a property, change (if necessary) the SSDIR
variable and then call use a target such as:

   <target name="getSource" depends="prepare">
      <exec command="ss cp ${SSProject}"/>
      <exec command="ss.exe get
${SSProject} -Y${SSUserName} -R -I- -O- -GL${buildDir}"/>
   </target>

This snippet works if I have manually set (either permanently via the
control panet or use a batch file external to the ant process) the SSDIR
prior to calling ant. I surmize that I cannot use something such as:

<exec command="set SSDIR=\\Sourcesafe2\70\">

because this would only set SSDIR for the currently executing process that
is created by a call to exec. Any hints on how I could accomplish this from
within the buildfile?

Thanks,
Dan


Re: Build problems

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "DM" == Dan MacKay <da...@kingston.hummingbird.com> writes:

 DM> d:\src\dal\DalBuild.xml:47: Could not create task of type:
 DM> MSVSSGET because I can't find it in the list of task class
 DM> definitions

The task's name is vssget not MSVSSGET. Does this help?

Stefan

Build problems

Posted by Dan MacKay <da...@kingston.hummingbird.com>.
Hi all,

Once again the newbie poses a question. When I call the following target:

   <target name="getSource" depends="prepare">
      <MSVSSGET login="${SSUserName},${SSUserPassword}"
vsspath="${SSDirectory}" recursive="true"/>
   </target>

I get the following build failure:

D:\src\dal>ant -buildfile d:\src\dal\DalBuild.xml getSource
Buildfile: d:\src\dal\DalBuild.xml

BUILD FAILED

d:\src\dal\DalBuild.xml:47: Could not create task of type: MSVSSGET because
I can't find it in the list of task class definitions

Total time: 1 seconds
D:\src\dal>

Any suggestions from the gurus?

Thanks,
Dan


Re: Environment variables

Posted by Alfonso Urdaneta <al...@malibunetworks.com>.
Stefan Bodewig wrote:
> 
> >>>>> "AM" == Adam Murdoch <ad...@yahoo.com> writes:
> 
>  AM> I have a feeling that support for the <env> element was added
>  AM> after ant 1.1 as released,
> 
> Trust your feeling 8^).
> 
>  AM> so you may have to upgrade to a nightly build to use this.
> 
> They still seem to be broken but it's being worked on.

Bummer.  That is like EXACTLY what I need as well.

When you say "they seem to be broken" are you referring to 

1. the nightly builds are actually 1.1 builds instead of new versions
and 
   hopefully will revert to being new versions soon, or 
2. the execute task itself is broken in the new release and is being
worked on 
   and this may take a while ?

Alfonso.

-- 
---------------------------------o0o---------------------------------
Alfonso Urdaneta                           alfonso@malibunetworks.com
Malibu Networks, Inc.                          www.malibunetworks.com
1035 Suncast Lane                                 Vox:   916.941.8772
Suite 130                                         Fax:   916.941.8850
El Dorado Hills, CA 95762

"Time flies like the wind, but fruit flies like bananas"

Re: Environment variables

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "AM" == Adam Murdoch <ad...@yahoo.com> writes:

 AM> I have a feeling that support for the <env> element was added
 AM> after ant 1.1 as released,

Trust your feeling 8^).

 AM> so you may have to upgrade to a nightly build to use this.

They still seem to be broken but it's being worked on.

 AM> 1. Write a wrapper script that your build script calls using
 AM> <exec>, passing the value for SSDIR as one of its arguments.
 AM> Check out antRun.bat for an example of a similar sort of script.

This should work in 1.1, while Execute has been added after the
release as well.

Stefan

RE: Environment variables

Posted by Adam Murdoch <ad...@yahoo.com>.
Hi,


The exec task allows you to specify the environment variables for the child
process.  You do this using nested <env> elements:

<exec ... >
	<env key="SSDIR" value="some value"/>
</exec>

Check out the documentation for the exec task for more info on using <env>.
You should note that if you specify any environment variables in the exec
task, then only these variables are passed to the child process.  The child
process will not inherit any of the parent process' (ie ant) environment in
this case.

I have a feeling that support for the <env> element was added after ant 1.1
as released, so you may have to upgrade to a nightly build to use this.

If you can't upgrade, then here's a couple of suggestions:

1. Write a wrapper script that your build script calls using <exec>, passing
the value for SSDIR as one of its arguments.  Check out antRun.bat for an
example of a similar sort of script.

2. Write your own task that calls the version of Runtime.exec() that lets
you pass in the environment for the child process (you might be able to use
the org.apache.tools.ant.taskdefs.Execute class to help you - but it might
not be available in ant 1.1).


Adam

> -----Original Message-----
> From: Dan MacKay [mailto:dan.mackay@kingston.hummingbird.com]
> Sent: Wednesday, 11 October 2000 5:43 AM
> To: ant-user@jakarta.apache.org
> Subject: Environment variables
>
>
> Hi all,
>
> I am a relative new user to ant and have the following question. Is it
> possible to manipulate DOS session environment variables from
> inside of ant.
> The problem I am having is setting up MS Source Safe environment variable
> SSDIR. This is would be to enable me to hand in the SS database that I
> wished to use for for a build as a property, change (if
> necessary) the SSDIR
> variable and then call use a target such as:
>
>    <target name="getSource" depends="prepare">
>       <exec command="ss cp ${SSProject}"/>
>       <exec command="ss.exe get
> ${SSProject} -Y${SSUserName} -R -I- -O- -GL${buildDir}"/>
>    </target>
>
> This snippet works if I have manually set (either permanently via the
> control panet or use a batch file external to the ant process) the SSDIR
> prior to calling ant. I surmize that I cannot use something such as:
>
> <exec command="set SSDIR=\\Sourcesafe2\70\">
>
> because this would only set SSDIR for the currently executing process that
> is created by a call to exec. Any hints on how I could accomplish
> this from
> within the buildfile?
>
> Thanks,
> Dan


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com