yet another part of the never ending nested property expansion story. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1554614 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -4,6 +4,13 @@ Changes from Ant 1.9.3 TO current | |||||
| Changes that could break older environments: | Changes that could break older environments: | ||||
| ------------------------------------------- | ------------------------------------------- | ||||
| * the prefixValues attribute of <property> didn't work as expected | |||||
| when set to false (the default). | |||||
| It is quite likely existing build files relied on the wrong | |||||
| behavior and expect Ant to resolve the value side against the | |||||
| properties defined in the property file itself - these build files | |||||
| must now explicitly set the prefixValues attribute to true. | |||||
| Bugzilla Report 54769 | |||||
| Fixed bugs: | Fixed bugs: | ||||
| ----------- | ----------- | ||||
| @@ -87,10 +87,19 @@ public class ResolvePropertyMap implements GetProperty { | |||||
| } | } | ||||
| seen.add(name); | seen.add(name); | ||||
| String recursiveCallKey = name; | |||||
| if (prefix != null && !expandingLHS && !prefixValues) { | |||||
| // only look up unprefixed properties inside the map | |||||
| // if prefixValues is true or we are expanding the key | |||||
| // itself | |||||
| recursiveCallKey = prefix + name; | |||||
| } | |||||
| expandingLHS = false; | expandingLHS = false; | ||||
| // will recurse into this method for each property | // will recurse into this method for each property | ||||
| // reference found in the map's value | // reference found in the map's value | ||||
| return parseProperties.parseProperties((String) map.get(name)); | |||||
| return parseProperties.parseProperties((String) map.get(recursiveCallKey)); | |||||
| } finally { | } finally { | ||||
| seen.remove(name); | seen.remove(name); | ||||
| } | } | ||||
| @@ -135,4 +135,19 @@ y=$${x} | |||||
| <property file="${input}/x.properties" prefix="foo"/> | <property file="${input}/x.properties" prefix="foo"/> | ||||
| <au:assertPropertyEquals name="foo.y" value="x"/> | <au:assertPropertyEquals name="foo.y" value="x"/> | ||||
| </target> | </target> | ||||
| <target name="testInternalExpansionWithPrefixOnlyExpandsWhenPrefixValuesIsTrue" | |||||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=54769"> | |||||
| <mkdir dir="${input}"/> | |||||
| <echo file="${input}/x.properties"><![CDATA[ | |||||
| a=A | |||||
| b=$${a} | |||||
| ]]></echo> | |||||
| <property file="${input}/x.properties" prefix="foo" prefixValues="true"/> | |||||
| <au:assertPropertyEquals name="foo.b" value="A"/> | |||||
| <property file="${input}/x.properties" prefix="bar" prefixValues="false"/> | |||||
| <au:assertPropertyEquals name="bar.b" value="$${a}"/> | |||||
| <property file="${input}/x.properties" prefix="baz"/> | |||||
| <au:assertPropertyEquals name="baz.b" value="$${a}"/> | |||||
| </target> | |||||
| </project> | </project> | ||||