ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peter.rei...@corvil.com>
Subject Re: macrodef multiple calls
Date Mon, 12 Jul 2004 14:08:34 GMT
You could refactor a little:

<target name="qa-rails">
   <property file="properties/qa/rails/common.properties"/>
   <blah web="qaj2kweb01" buildtype="rails"/>
   <blah web="qaj2kweb02" buildtype="rails"/>
</target>

<macrodef name="blah">
    <attribute name="web"/>
    <attibute name="buildtype"/>
   <sequential>
     <property prefix="@{web}." file="properties/qa/@{web}.properties"/>
     <mkdir dir="temp-${@{web}.deployment.name}/bin" />
    .
     .

Peter
Khehra, Sukh wrote:

>never mind. i know what's going on. the property "deployment.name" being set in the first
property file is overriding subsequent macro calls. is there any way to avoid that?
>
>-----Original Message-----
>From: Khehra, Sukh 
>Sent: Monday, July 12, 2004 9:46 AM
>To: user@ant.apache.org
>Subject: macrodef multiple calls
>
>
>this simple code of mine runs the macro once evn though i am calling it 5 times. any idea
why?
>
>***************************build.xml*******************************
><project name="new-build" default="qa-rails">
>
><target name="qa-rails">
><blah srv="properties/qa/qaj2kweb01.properties" comm="properties/qa/rails/common.properties"
buildtype="rails"/>
><blah srv="properties/qa/qaj2kweb02.properties" comm="properties/qa/rails/common.properties"
buildtype="rails"/>
><blah srv="properties/qa/qaj2kweb03.properties" comm="properties/qa/rails/common.properties"
buildtype="rails"/>
><blah srv="properties/qa/qaj2kweb04.properties" comm="properties/qa/rails/common.properties"
buildtype="rails"/>
><blah srv="properties/qa/qaj2kweb05.properties" comm="properties/qa/rails/common.properties"
buildtype="rails"/>
></target>
>
><macrodef name="blah">
>	<attribute name="srv"/>
>	<attribute name="comm"/>
>	<attribute name="buildtype"/>
>	
>	<sequential>
>		<property file="@{srv}"/>
>		<property file="@{comm}"/>
>		
>		<mkdir dir="temp-${deployment.name}/bin" />
>		<mkdir dir="temp-${deployment.name}/conf" />
>		<mkdir dir="temp-${deployment.name}/libexec" />
>		
>		<copy todir="temp-${deployment.name}/bin">
>		    <fileset dir="templates/@{buildtype}/bin" />
>		    <filterchain><expandproperties/></filterchain>
>		</copy>
>		
>		<copy todir="temp-${deployment.name}/libexec">
>		    <fileset dir="templates/@{buildtype}/libexec" />
>		</copy>
>	        
>	        <copy todir="temp-${deployment.name}/conf">
>	            <fileset dir="templates/@{buildtype}/conf" />
>	            <filterchain><expandproperties/></filterchain>
>	        </copy>
>		
>		<tar destfile="apache-${deployment.name}.tar">
>		    <tarfileset dir="temp-${deployment.name}" includes="**/" />
>		</tar>
>		
>		<echo message="end"/>
>	</sequential>
></macrodef>
>
></project>
>
>********************output from ant run************************************
>C:\Documents and Settings\KhehraS\My Documents\apache-conf>ant
>Buildfile: build.xml
>
>qa-rails:
>    [mkdir] Created dir: C:\Documents and Settings\KhehraS\My Documents\apache-conf\temp-qaj2kweb01\bin
>
>    [mkdir] Created dir: C:\Documents and Settings\KhehraS\My Documents\apache-conf\temp-qaj2kweb01\conf
>
>    [mkdir] Created dir: C:\Documents and Settings\KhehraS\My Documents\apache-conf\temp-qaj2kweb01\libexec
>
>     [copy] Copying 2 files to C:\Documents and Settings\KhehraS\My Documents\apache-conf\temp-qaj2kweb01\bin
>
>     [copy] Copying 3 files to C:\Documents and Settings\KhehraS\My Documents\apache-conf\temp-qaj2kweb01\libexec
>
>     [copy] Copying 2 files to C:\Documents and Settings\KhehraS\My Documents\apache-conf\temp-qaj2kweb01\conf
>
>      [tar] Building tar: C:\Documents and Settings\KhehraS\My Documents\apache-conf\apache-qaj2kweb01.tar
>
>     [echo] end
>
>      [tar] Nothing to do: C:\Documents and Settings\KhehraS\My Documents\apache-conf\apache-qaj2kweb01.tar
is up to date.
>
>     [echo] end
>
>      [tar] Nothing to do: C:\Documents and Settings\KhehraS\My Documents\apache-conf\apache-qaj2kweb01.tar
is up to date.
>
>     [echo] end
>
>      [tar] Nothing to do: C:\Documents and Settings\KhehraS\My Documents\apache-conf\apache-qaj2kweb01.tar
is up to date.
>
>     [echo] end
>
>      [tar] Nothing to do: C:\Documents and Settings\KhehraS\My Documents\apache-conf\apache-qaj2kweb01.tar
is up to date.
>
>     [echo] end
>
>BUILD SUCCESSFUL
>Total time: 3 seconds
>
>
>---------------------------------------------------------------------
>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
>
>
>
>  
>


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


Mime
View raw message