ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knuplesch, Juergen" <Juergen.Knuple...@icongmbh.de>
Subject AW: Setting environment variables
Date Fri, 26 Feb 2010 07:15:01 GMT
Thanks for the answers.


I use now
Option 4a
I played around by creating a .bat file that calls the settings .bat file through a Windows
system variable. 
My ANT fills this system variable with the correct path.
Afterwards in the .bat file I call ant again, to compile the sources:

ANT sets the env variable for setup
     <exec executable="cmd.exe" dir="." failonerror="true" failifexecutionfails="true">
       <arg value="/c"/>
       <arg value="dmake2.bat" />
       <env key="MAKE_DIR" path="${svn.exportboxbase}"/>
       <env key="PROPNAMEPREFIX" path="trunk_"/>
       <env key="COMPILER_SETTINGS" path="D:/Programme/Microsoft Visual Studio 9.0/VC/bin/vcvars32.bat"/>
     </exec> 


Batch calls teh env variable for setup and afterwards ant to compile:
call "%COMPILER_SETTINGS%"
ant -f dopecomposebuild_ant.xml compile3

Greetings
-- 
Jürgen Knuplesch   
-----Ursprüngliche Nachricht-----
Von: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Gesendet: Donnerstag, 25. Februar 2010 06:12
An: user@ant.apache.org
Betreff: AW: Setting environment variables

Option 4:
create a batch file that calls your 'setenv' and then the dmake.
Call this from Ant
   <echo file="x.bat">
       call setenv.bat
       call dmake ...
   </echo>
   <exec executable="cmd.exe">
       <arg line="/C x.bat"/>
   </exec>


Jan

>-----Ursprüngliche Nachricht-----
>Von: Rez P [mailto:pons32@hotmail.com]
>Gesendet: Mittwoch, 24. Februar 2010 20:02
>An: Ant
>Betreff: RE: Setting environment variables
>
>
>When your batch file is invoked all variables declared by the set 
>command will not get passed to the 2nd instance of the dos/command 
>window.  You have to play around with command /c to get this to work.
> 
> 
>Other alternatives:
> 
>Option 1: 
>If you're on a Windows machine, declare all the variables in your 
>system environment.
> 
> 
>Option2: 
>Assuming the batch file resides directly at the root of your project 
>then in the batch file when you call your build.xml simply pass the 
>args at the command line like so:
> 
>call ant -Dcompiler.Arg1=value -Dcompiler.Arg2=value targetX targetY 
>targetZ
> 
>the values can be pre-defined by the set command in the begining of the 
>batch file.
> 
>Option3: 
>You can declare a property file at the begining of your ant file and 
>set all the values in the property file to be loaded up
> 
><property file="./build.properties"/>
> 
>content of the property file:
> 
>compiler.Arg1=value
>compiler.Arg2=value
> 
>
>Rez
> 
>> Subject: Setting environment variables
>> Date: Wed, 24 Feb 2010 16:12:08 +0100
>> From: Juergen.Knuplesch@icongmbh.de
>> To: user@ant.apache.org
>> 
>> Hello,
>> 
>> I want to run a dmake using ANT to compile some C-Source.
>> 
>> There is a Batchfile that sets up some compiler environment
>variables.
>> Now I want to run this Batchfile and then execute a dmake
>that uses these environment variables.
>> 
>> Is it possible to get the environmet variables "inside" ANT?
>> How?
>> 
>> This is what I do and what does not work:
>> 
>> <exec executable="cmd.exe" dir="D:/Programme/Microsoft
>Visual Studio 9.0/VC/bin" >
>> <arg value="vcvars32.bat" />
>> </exec>
>> 
>> <property environment="env" />
>> <echo level="info" message="env.Path=${env.Path}" /> <echo 
>> level="info"
>message="env.FrameworkVersion=${env.FrameworkVersion}" />
>> 
>> <exec executable="${make.exefile}" dir="${svn.exportbox}/dope/src"> 
>> <env key="Path" path="${make.dir};${env.Path}" /> <env key="INIT" 
>> path="${make.dir}" /> <env key="CPDEVROOT" 
>> path="${svn.exportboxbase}" /> <env key="CPLIBROOT" 
>> path="${svn.exportboxbase}/cplib" /> <env key="CPLCC" 
>> path="${make.c.compiler}" />
>> 
>> 
>> <arg value="${make.c.compiler}=1"/>
>> <arg value="${make.system}=1"/>
>> <arg value="RELEASE=1"/>
>> <arg value="-u"/>
>> <arg value="-v"/>
>> </exec>
>> 
>> --
>> Jürgen Knuplesch
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>> additional commands, e-mail: user-help@ant.apache.org
>> 
> 		 	   		  
>_________________________________________________________________
>Hotmail: Powerful Free email with security by Microsoft.
>http://clk.atdmt.com/GBL/go/201469230/direct/01/
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message