ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject <property file="..." prefix="..."/> what to expand?
Date Thu, 17 Jun 2010 15:10:29 GMT
Hi,

when we have a file x.properties file like

x=x
y=${x}

and

    <property name="x" value="y"/>
    <property file="x.properties"/>

the ${y} will end up being "y", which is fine - properties are
immutable.

If you use

    <property file="x.properties" prefix="foo"/>

instead, Ant 1.8.0 will set ${foo.y} to "y" as well as it doesn't apply
the prefix when expanding ${x}.  Ant 1.8.1 uses the prefix when
expanding ${x} inside the file and thus expands ${foo.y} to "x" which
makes sense in that it makes the property file self-contained.

There is an open bug report against 1.8.1 that wants the old behavior
back <https://issues.apache.org/bugzilla/show_bug.cgi?id=49373>.

Locally I have a version of trunk that reinstates 1.8.0's behavior, but
that same version breaks the AntUnit tests for <loadproperties> with a
prefix attribute because the 1.8.1 way is explicitly expected here.

We don't have any documentation either way.

I see the following choices:

  (1) embrace <loadproperties prefix="..."/> way for <property file> as
      well and document it as a breaking change that already occured in
      1.8.1

  (2) make <loadproperties> prefix useless, remove it again, make
      <loadproperties> match <property file> of Ant 1.8.0 and earlier.

  (3) allow different behavior of the tasks and document it.

I can't say I'd like either of the three choices too much, maybe anybody
sees a different option.  (1) looks most attractive to me but there
doesn't seem to be a workaround if you want the old behavior back.

Stefan

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


Mime
View raw message