ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject RE: macrodef multiple calls
Date Mon, 12 Jul 2004 14:06:58 GMT
The obvois way is to pass deployment.name as an
attribute to macrodef. The other way is use <variable>
task from ant-contrib[1]

HTH Ivan 

[1]http://ant-contrib.sourceforge.net/tasks/variable_task.html

--- "Khehra, Sukh" <Sukh.Khehra@wsj.com> 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
> 
> 



		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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


Mime
View raw message