ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Araya <>
Subject Newbie question
Date Fri, 20 Apr 2012 21:00:58 GMT
I have a macrodef called init that defines an attribute called dest

<macrodef name="init">
	<attribute name="dest" default="html_content"/>
			<available file="${dest}" type="dir" />
				<echo message="Directory ${dest} exist... skiping" />
				<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"/>
			Copy CSS, JS and any images into their directories 
		<copy todir="${dest}/css">
			<fileset dir="." casesensitive="yes">
			  <include name="*.css"/>
		<copy todir="${dest}/js">
			<fileset dir="." casesensitive="yes">
			  <include name="*.js"/>
		<copy todir="${dest}/images">
			<fileset dir="." casesensitive="yes">
			  <include name="*.jpg"/>
			  <include name="*.gif"/>
			  <include name="*.png"/>

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}
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

View raw message