diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 83eb91a32..32d902f70 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -157,6 +157,7 @@ Jay van der Meer JC Mann J D Glanville Jean-Francois Brousseau +Jean-Louis Boudart Jeff Gettle Jeff Martin Jeff Tulley diff --git a/WHATSNEW b/WHATSNEW index 830967f66..d6bcd4281 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -30,6 +30,9 @@ Fixed bugs: * by default fails when run on JDK 8. Bugzilla Report 53347. + * ExtensionPoint doesn't work with nested import/include + Bugzilla Report 53405. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/ExtensionPoint.java b/src/main/org/apache/tools/ant/ExtensionPoint.java index bc0f35b50..494c4a2d3 100644 --- a/src/main/org/apache/tools/ant/ExtensionPoint.java +++ b/src/main/org/apache/tools/ant/ExtensionPoint.java @@ -25,8 +25,19 @@ package org.apache.tools.ant; */ public class ExtensionPoint extends Target { - // no "clone" constructor since I'm not really sure where it is - // used + public ExtensionPoint() { + + } + + /** + * Cloning constructor. + * @param other the Target to clone. + */ + public ExtensionPoint(Target other) { + //Should we have a clone constructor taking an ExtensionPoint as parameter? + super(other); + } + private static final String NO_CHILDREN_ALLOWED = "you must not nest child elements into an extension-point"; @@ -45,4 +56,4 @@ public class ExtensionPoint extends Target { throw new BuildException(NO_CHILDREN_ALLOWED); } -} \ No newline at end of file +} diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java index bda99346e..24d74df19 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java @@ -1019,7 +1019,11 @@ public class ProjectHelper2 extends ProjectHelper { // In an imported file (and not completely // ignoring the project tag or having a preconfigured prefix) String newName = prefix + sep + name; - Target newTarget = usedTarget ? new Target(target) : target; + Target newTarget = target; + if (usedTarget) { + newTarget = "target".equals(tag) + ? new Target(target) : new ExtensionPoint(target); + } newTarget.setName(newName); context.getCurrentTargets().put(newName, newTarget); project.addOrReplaceTarget(newName, newTarget); diff --git a/src/tests/antunit/core/extension-point-test.xml b/src/tests/antunit/core/extension-point-test.xml index e1875b9fc..a3f504e9f 100644 --- a/src/tests/antunit/core/extension-point-test.xml +++ b/src/tests/antunit/core/extension-point-test.xml @@ -88,6 +88,80 @@ + + + + +]]> + + + + in compile java + +]]> + + +]]> + + + + + + + + + + +]]> + + + + in compile java + +]]> + + +]]> + + + + + + + + + + +]]> + + + + in compile java + +]]> + + +]]> + + + + + + + +