ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perrier, Nathan" <nperr...@ptc.com>
Subject RE: Newbie question
Date Fri, 20 Apr 2012 21:03:34 GMT
1. Use @{dest} instead of ${dest}

-----Original Message-----
From: Carlos Araya [mailto:carlos.araya@gmail.com] 
Sent: Friday, April 20, 2012 4:01 PM
To: user@ant.apache.org
Subject: Newbie question

I have a macrodef called init that defines an attribute called dest

<macrodef name="init">
	<attribute name="dest" default="html_content"/>
	<sequential>
		<if>
			<available file="${dest}" type="dir" />
			<then>
				<echo message="Directory ${dest}
exist... skiping" />
			</then>
			<else>
				<echo>Creating directory</echo>
				<mkdir dir="${dest}/"/>
				<echo>Creating CSS directory</echo>
				<mkdir dir="${dest}/css"/>
				<echo>Creating JS directory</echo>
				<mkdir dir="${dest}/js"/>
				<echo>Creating image directory</echo>
				<mkdir dir="${dest}/images"/>
			</else>
		</if>
		<!-- 
			Copy CSS, JS and any images into their
directories 
		-->
		<copy todir="${dest}/css">
			<fileset dir="." casesensitive="yes">
			  <include name="*.css"/>
			</fileset>
		</copy>
		<copy todir="${dest}/js">
			<fileset dir="." casesensitive="yes">
			  <include name="*.js"/>
			</fileset>
		</copy>
		<copy todir="${dest}/images">
			<fileset dir="." casesensitive="yes">
			  <include name="*.jpg"/>
			  <include name="*.gif"/>
			  <include name="*.png"/>
			</fileset>
		</copy>
	</sequential>
</macrodef>

I havea couple questions:

1, How can I replace the ${dest} variable with the value of the
attribute. The task is working when called like this:

<init dest="html_content"/> 
<init />

But it is not generating the html_content directory. It is literally
generation the ${dest} directory. 
 
2. Is it possible to call it from a different task in the same build
file?  I want to be able to use the value of ${dest} in other places on
the build file but haven't been able to figure out how. 


Thanks for all your help

Carlos

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


Mime
View raw message