ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Proposed way to make ${} happen at runtime
Date Fri, 08 Sep 2000 10:42:43 GMT
the appended patch will move ${} expansion (and the execution of all
tasks, including <property>) to runtime instead of parser time.

As there are so many ways this could be implemented I wanted to make
sure I'm not totally of the hook and have introduced silly design
flaws. Therefore I wanted to get you comments before I commit
anything.

The patched version has been working for me (bootstrapped Ant and
built Tomcat as well as my private projects successfully).

<project name="test" default="echo">
  <target name="echo1">
    <echo message="${echo1}" />
  </target>
  <property name="echo1" value="set globally" />

  <target name="echo2" depends="setup2">
    <echo message="${echo2}" />
  </target>

  <target name="setup2">
    <property name="echo2" value="set after first use" />
  </target>

  <target name="setup3a">
    <property name="echo3" value="set in unused target" />
  </target>

  <target name="setup3">
    <property name="echo3" value="set before first use" />
  </target>

  <target name="echo3" depends="setup3">
    <echo message="${echo3}" />
  </target>

  <target name="echo" depends="echo1,echo2,echo3" />
</project>

will now generate

echo1:
set globally
setup2:
echo2:
set after first use
setup3:
echo3:
set before first use
echo:

instead of

echo1:
${echo1}
setup2:
echo2:
${echo2}
setup3:
echo3:
set in unused target
echo:

Comments please (including how stupid I am if this should be true).

Stefan


Mime
View raw message