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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to