ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dick, Brian E." <Brian.D...@FMR.com>
Subject PropertySet use in macro
Date Wed, 01 Sep 2004 16:03:51 GMT
Is there a way to use a PropertySet as a parameter to a macro in the
same way you can use a PropertySet as a parameter to a antcall?

With antcall I can do the following

   <property name="foo.p1" value="Hello"/>
   <property name="foo.p2" value="World"/>

   <propertyset id="foo.propset">
      <propertyref prefix="foo"/>
   </propertyset>

   <target name="test_propset">
      <antcall target="test_propset2">
         <propertyset refid="foo.propset"/>
      </antcall>
   </target>

   <target name="test_propset2">
      <echo message="foo.p1 is ${foo.p1}"/>
      <echo message="foo.p2 is ${foo.p2}"/>
   </target>

And the result is

   test_propset:

   test_propset2:
        [echo] foo.p1 is Hello
        [echo] foo.p2 is World

With a macro I would like to do something like the following

   <property name="foo.p1" value="Hello"/>
   <property name="foo.p2" value="World"/>

   <propertyset id="foo.propset">
      <propertyref prefix="foo"/>
   </propertyset>

   <target name="test_propset">
      <test_propset2 refid="foo.propset"/>
   </target>

   <macrodef name="test_propset2">
      <attribute name="foo.p1"/>
      <attribute name="foo.p2"/>

      <sequential>
         <echo message="foo.p1 is @{foo.p1}"/>
         <echo message="foo.p2 is @{foo.p2}"/>
      </sequential>
   </macrodef>

And the result would be

   test_propset:
        [echo] foo.p1 is Hello
        [echo] foo.p2 is World

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


Mime
View raw message