ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jill Stephenson" <jill.stephen...@suncorpmetway.com.au>
Subject Re: Setting envrionment variables from within build.xml
Date Thu, 06 Dec 2001 23:18:54 GMT
How about looking at the problem another way and extracting out
the common code into a subtarget to which you can pass a parameter
using the antcall task.  Something along the lines of the following ...

<target name="BuildEnvironmentPkg.make" >
   <exec executable="msdev.exe">
     <env key="CL" value="${MsdevDefines}" />
     <arg line="${basedir}/Code/EnvironmentPkg/EnvironmentPkg.dsw /MAKE
'${envName} - Win32 ${BuildConfig}'" />
   </exec>
</target>

<target name="BuildEnvironmentPkg" depends="Init" if="BuildConfig" >
  <antcall target="BuildEnvironmentPkg.make">
    <param name="envName" value="'Environment" />
  </antcall>
  <antcall target="BuildEnvironmentPkg.make">
    <param name="envName" value="'EnvironmentAutoTest" />
  </antcall>
</target>

--
Jill

----- Original Message -----
From: "Ron Coutts" <RonC@quadrus.com>
To: "'Ant Users List' (E-mail)" <ant-user@jakarta.apache.org>
Sent: Friday, December 07, 2001 8:59 AM
Subject: Setting envrionment variables from within build.xml


I was wondering if there's any way in Ant to set an environment variable
once before a series of <exec> tasks.  Consider the snippet of build.xml
below that is used to set the environment variable 'CL' before executing
the command line compiler 'msdev.exe'.  This XML works, but is an error
prone maintenace headache because the nested element <env> must be
repeatedly used.  Is there any way around this, such that I can set  the
environment variable 'CL' once before multiple <exec>'s?

Ron Coutts


<target name="BuildEnvironmentPkg" depends="Init"
if="BuildConfig" >
<exec executable="msdev.exe">
<env key="CL" value="${MsdevDefines}" />
<arg
line="${basedir}/Code/EnvironmentPkg/EnvironmentPkg.dsw /MAKE
'Environment - Win32 ${BuildConfig}'" />
</exec>
<exec executable="msdev.exe">
<env key="CL" value="${MsdevDefines}" />
<arg
line="${basedir}/Code/EnvironmentPkg/EnvironmentPkg.dsw /MAKE
'EnvironmentAutoTest - Win32 ${BuildConfig}'" />
</exec>
</target>

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



-----------------------------------------------------------------------------------

The contents of this message are the views of the Author and do not necessarily reflect the
views of SUNCORP METWAY LTD  ABN 66 010 831 722. 

The content of this e-mail, including attachments is a confidential communication between
the Suncorp Metway Group and the intended addressee. Any unauthorised use of the contents
is expressly prohibited. If you have received this e-mail in error please contact the sender
immediately and then delete the message and any attachment(s).

http://www.suncorpmetway.com.au


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


Mime
View raw message