Browse Source

remove resolution for references that are not resolved during normal runtime execution

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@572374 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
32ccb517d0
3 changed files with 28 additions and 26 deletions
  1. +4
    -1
      WHATSNEW
  2. +1
    -25
      src/main/org/apache/tools/ant/Project.java
  3. +23
    -0
      src/tests/antunit/types/conditions/isreference-test.xml

+ 4
- 1
WHATSNEW View File

@@ -24,7 +24,10 @@ Changes that could break older environments:
* In the <touch> task when a <mapper> is used, the millis and datetime * In the <touch> task when a <mapper> is used, the millis and datetime
attributes now override the time of the source resource if provisioned. attributes now override the time of the source resource if provisioned.
Bugzilla report 43235. Bugzilla report 43235.

* Remove fall-back mechanism for references that are not resolved
during normal runtime execution.

Fixed bugs: Fixed bugs:
----------- -----------




+ 1
- 25
src/main/org/apache/tools/ant/Project.java View File

@@ -1885,28 +1885,6 @@ public class Project implements ResourceFactory {
parentIdProject = parent; parentIdProject = parent;
} }


/**
* Attempt to resolve an Unknown Reference using the
* parsed id's - for BC.
*/
private Object resolveIdReference(String key, Project callerProject) {
UnknownElement origUE = (UnknownElement) idReferences.get(key);
if (origUE == null) {
return parentIdProject == null
? null
: parentIdProject.resolveIdReference(key, callerProject);
}
callerProject.log(
"Warning: Reference " + key + " has not been set at runtime,"
+ " but was found during" + LINE_SEP
+ "build file parsing, attempting to resolve."
+ " Future versions of Ant may support" + LINE_SEP
+ " referencing ids defined in non-executed targets.", MSG_WARN);
UnknownElement copyUE = origUE.copy(callerProject);
copyUE.maybeConfigure();
return copyUE.getRealThing();
}

/** /**
* Add an id reference. * Add an id reference.
* Used for broken build files. * Used for broken build files.
@@ -1963,9 +1941,7 @@ public class Project implements ResourceFactory {
if (ret != null) { if (ret != null) {
return ret; return ret;
} }
// Check for old id behaviour
ret = resolveIdReference(key, this);
if (ret == null && !key.equals(MagicNames.REFID_PROPERTY_HELPER)) {
if (!key.equals(MagicNames.REFID_PROPERTY_HELPER)) {
try { try {
if (PropertyHelper.getPropertyHelper(this).containsProperties(key)) { if (PropertyHelper.getPropertyHelper(this).containsProperties(key)) {
log("Unresolvable reference " + key log("Unresolvable reference " + key


+ 23
- 0
src/tests/antunit/types/conditions/isreference-test.xml View File

@@ -0,0 +1,23 @@
<project name="isreference-test" default="antunit"
xmlns:au="antlib:org.apache.ant.antunit">

<import file="../../antunit-base.xml" />

<target name="out-of-band">
<path id="out-of-band" path="."/>
</target>

<target name="testOutOfBand">
<au:assertFalse>
<isreference refid="out-of-band"/>
</au:assertFalse>
</target>

<target name="testInBand">
<path id="in-band" path="."/>
<au:assertTrue>
<isreference refid="in-band"/>
</au:assertTrue>
</target>
</project>


Loading…
Cancel
Save