ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davy Toch <Davy.T...@belgacom.net>
Subject Scoped variables in macrodefs using entity includes.
Date Tue, 13 Sep 2005 17:20:11 GMT
Just wanted to share our (temporary) solution we currently use to have 
scoped variables in macrodefs. Not ideal, but it currently works.

build.xml:

<?xml version='1.0'?>
<!DOCTYPE project [
  <!ENTITY uid "be.steria.ant.addon.0.3.base">
]>
<project basedir="." name="&uid;" default="test">

  <import file="macrodef.xml"/>

  <target name="test">
    <property name="&uid;.test" value="zzz"/>
    <echo>&uid;.test : ${&uid;.test}</echo>
    <test-macrodef test="${&uid;test}"/>
  </target>

</project>

macrodef.xml

<?xml version='1.0'?>
<!DOCTYPE project [
  <!ENTITY uid "be.steria.ant.addon.0.3.test">
]>
<project basedir="." name="&uid;">

  <macrodef name="test-macrodef">
    <attribute name="test"/>
    <sequential>
      <property name="&uid;.test" value="yyy"/>
      <echo>&uid;.test : ${&uid;.test}</echo>
    </sequential>
  </macrodef>

</project>

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


Mime
View raw message