ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <ddevie...@gmail.com>
Subject Re: <property file="..." prefix="..."/> what to expand?
Date Fri, 18 Jun 2010 14:48:09 GMT
On Fri, Jun 18, 2010 at 2:47 AM, Stefan Bodewig <bodewig@apache.org> wrote:
> On 06/17/2010 11:10 AM, Stefan Bodewig wrote:
> Assume
>
> x=x
> y=${x}
>
> and that there is no property x defined prior to
>
>    <property file="..."/>
>
> then ${y} will be "x".  Using
>
>    <property file="..." prefix="foo"/>
>
> ${foo.y} in Ant 1.8.0 is ${x} while it is "x" in 1.8.1 - the properties
> file was able to refer to its own properties without knowledge of the
> prefix.

This feels "natural" to me, and ${foo.y}'s value being "${x}" surprising indeed.
But conversely, if property x is already defined, I'd expect that
value to prevail, according to classic immutability rules.
Yet as you point out we can't have both behaviors at the same time if
I understand correctly.

Can't property expansion in a property file be done "entirely" before
the prefix is applied?
It seems that this way both cases would work, and the prefix attribute
could be documented to be applied a-posteriori on the newly created
properties?
Hmmm, a caveat of this approach is that assigning to an already
defined property would have no effect, unless its name was already
prefixed... I think I've cornered myself in :)

>> but breaking the established behavior of the widely used <property>
>> task seems a bad idea.
>
> I tend to agree, but we are really talking about some sort of bordercase.

Another impractical idea quite likely, but what about a ${.:x}
notation, to force the expansion of propery x to point to the "local"
context, taking the prefix into account? It gives a way about of this
conundrum maybe, if it can be implemented that is, which I haven't
checked out course. Just throwing the idea around. --DD

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


Mime
View raw message