Ant Property containing Macrodef Parameters

ant

Is there a way to put a value in a property that contains a macrodef parameter string?

For example, in the following macrodef I would like to add the ${build.dir}/widget/@{platform}/@{resolution}/${widget.name} to a property as it is used in several macrodefs.

<macrodef name="setBuildstamp">
    <attribute name="platform" />
    <attribute name="resolution" />
    <sequential>
      <replace file="${build.dir}/widget/@{platform}/@{resolution}/${widget.name}/Contents/Javascript/views/sidebar/DevSettingsView.js" token="%%%BUILD_TIMESTAMP%%%" value="${build.timestamp}" />
    </sequential>
</macrodef>

would become

<property name="widget.base" value"${build.dir}/widget/@{platform}/@{resolution}/${widget.name}" />

<macrodef name="setBuildstamp">
    <attribute name="platform" />
    <attribute name="resolution" />
    <sequential>
         <replace file="${widget.base}/Contents/Javascript/views/sidebar/DevSettingsView.js" token="%%%BUILD_TIMESTAMP%%%" value="${build.timestamp}" />
    </sequential>
</macrodef>

Best Solution

In ant 1.8, you've got the local task, which was designed specifically for this.

Related Question