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 RE: PropertySet use in macro
Date Wed, 01 Sep 2004 17:20:06 GMT
A target can do it. Why can't a macro?

Here's another option that doesn't involve changing the way macros work.
I need some means of using a refid to access the Properties in a
PropertySet. Something like the following.

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

   <propertyset id="foo1.propset">
      <propertyref prefix="foo1"/>
      <mapper type="glob" from="foo1*" to="bar*"/>
   </propertyset>

   <target name="test">
      <echo>${foo1.propset:bar.p1}</echo>
      <echo>${foo1.propset:bar.p2}</echo>
   </target>

In a macro it would look something like

   <macrodef name="test">
      <attribute name="refid"/>
      <sequential>
         <echo>${@{refid}:bar.p1}</echo>
         <echo>${@{refid}:bar.p2}</echo>
      </sequential>
   </macrodef>

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Wednesday, September 01, 2004 12:52 PM
To: Ant Users List
Subject: RE: PropertySet use in macro


> From: Matt Benson [mailto:gudnabrsam@yahoo.com]
> 
> That's big, without having read this followup let me
> go from what I got from your initial query:  You'd
> like to be able to automagically assign properties to
> <macrodef> attributes, right?  This is kind of insane
> but I sort of like it, especially given the fact that
> a <propertyset> can contain a <mapper>.  I might play
> with adding this unless Peter or someone else has a
> strong objection to its inclusion.

Hmmm, I don't think I like this idea. This is populating
the attributes of a task (or group of tasks) implicitly
from properties which can be defined anywhere, including
in external properties files.

It's a bit like <javac attributefile="some-file.properties" />

With some-file.properties that contains:
debug = true
listfiles = false

And automagically it's equivalent to

<javac debug="true" listfiles="false" />

Very obscure and weird in fact. No, I don't like it.
Not sure if I'd be -1 yet, but I'm pretty close.

Properties should be properties,
and task attributes task attributes. --DD

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

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


Mime
View raw message