ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject Re: "Overriding previous definition of reference" ... should I worry?
Date Thu, 28 Jun 2007 16:42:52 GMT
On 6/28/07, Jay Dickon Glanville <dickon.glanville@gmail.com> wrote:
> If I can ask you, and the rest of the community, for a touch more clarification.
>
> In my example,
> 01]  <project basedir="." default="compile" name="example">
> 02]    <patternset id="depender">
> 03]      <patternset refid="dependee" />
> 04]    </patternset>
> 05]    <patternset id="dependee">
> 06]    </patternset>
> 07]    <target name="compile" >
> 08]      <echo>doing nothing</echo>
> 09]    </target>
> 10]  </project>
>
> Line 03, the reference to another patternset (one that hasn't been
> declared yet) in essence creates it.  It's initial value is probably
> an empty set.

For historical and BC reasons, id's are handled at XML parse time, not
runtime. Your interpretation assumes runtime, which is incorrect.
OTOH, refid's are in fact handled at runtime only.

> Later on, on line 05 (where the patternset officially gets declared)
> the patternset gets modified with whatever the decoration gives it.

I'm not sure what you mean by decoration.

> So, as long as all my patternset declarations are grouped together at
> the top of my build file, and there are no targets interspersed,
> everything should be fine for me.

Since id's are handled at parse time, there can be some funny business...

> Is my interpretation correct?

Things could have changed, and Peter is the expert in these matters,
but I encourage you to add 'meat' to your patternsets, and exercise
them against a control set of files, to figure out for yourself.

But in general, I don't think it's a good idea to use an id which
hasn't been declared beforehand, especially given the special nature
of id handling in Ant. You're asking for trouble ;-) --DD

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


Mime
View raw message