git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275472 13f79535-47bb-0310-9956-ffa450edef68master
@@ -70,7 +70,7 @@ | |||||
<typedef loaderref="nested.loader" classpathref="nested.classes" | <typedef loaderref="nested.loader" classpathref="nested.classes" | ||||
name = "myvalue" | name = "myvalue" | ||||
classname="${nested.package}AddTypeTest$MyValue"/> | classname="${nested.package}AddTypeTest$MyValue"/> | ||||
</target> | |||||
</target> | |||||
<target name="nested.a" depends="init"> | <target name="nested.a" depends="init"> | ||||
<nested.container> | <nested.container> | ||||
@@ -83,7 +83,7 @@ | |||||
<nested.b/> | <nested.b/> | ||||
</nested.container> | </nested.container> | ||||
</target> | </target> | ||||
<target name="nested.c" depends="init"> | <target name="nested.c" depends="init"> | ||||
<nested.container> | <nested.container> | ||||
<nested.c/> | <nested.c/> | ||||
@@ -102,18 +102,21 @@ | |||||
<nested.condition.type/> | <nested.condition.type/> | ||||
<echo>after</echo> | <echo>after</echo> | ||||
</target> | </target> | ||||
<target name="condition.task" depends="init"> | <target name="condition.task" depends="init"> | ||||
<echo>before</echo> | <echo>before</echo> | ||||
<nested.condition.task/> | <nested.condition.task/> | ||||
<echo>after</echo> | <echo>after</echo> | ||||
</target> | </target> | ||||
<target name="condition.condition.type" depends="init"> | <target name="condition.condition.type" depends="init"> | ||||
<condition property="condition.condition.type"> | <condition property="condition.condition.type"> | ||||
<nested.condition.type/> | <nested.condition.type/> | ||||
</condition> | </condition> | ||||
</target> | </target> | ||||
<target name="condition.condition.task" depends="init"> | <target name="condition.condition.task" depends="init"> | ||||
<condition property="condition.condition.task">> | |||||
<condition property="condition.condition.task"> | |||||
<nested.condition.task/> | <nested.condition.task/> | ||||
</condition> | </condition> | ||||
</target> | </target> | ||||
@@ -124,4 +127,11 @@ | |||||
</myaddconfigured> | </myaddconfigured> | ||||
</target> | </target> | ||||
<target name="namespacetest" xmlns:prefix="uri"> | |||||
<typedef name="eq" uri="uri" | |||||
classname="org.apache.tools.ant.taskdefs.condition.Equals"/> | |||||
<condition property="p"> | |||||
<prefix:eq arg1="a" arg2="b"/> | |||||
</condition> | |||||
</target> | |||||
</project> | </project> |
@@ -57,6 +57,7 @@ package org.apache.tools.ant; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | |||||
import java.util.Locale; | import java.util.Locale; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
@@ -106,6 +107,31 @@ public class UnknownElement extends Task { | |||||
this.elementName = elementName; | this.elementName = elementName; | ||||
} | } | ||||
/** | |||||
* Makes a new unknown element based on this unknownelement | |||||
* does not copy the children | |||||
*/ | |||||
public UnknownElement copyItem() { | |||||
UnknownElement ret = new UnknownElement(getTag()); | |||||
ret.setNamespace(getNamespace()); | |||||
ret.setProject(getProject()); | |||||
ret.setQName(getQName()); | |||||
ret.setTaskName(getTaskName()); | |||||
ret.setLocation(getLocation()); | |||||
ret.setOwningTarget(getOwningTarget()); | |||||
RuntimeConfigurable rc = new RuntimeConfigurable( | |||||
ret, getTaskName()); | |||||
rc.setPolyType(getWrapper().getPolyType()); | |||||
Map map = getWrapper().getAttributeMap(); | |||||
for (Iterator i = map.entrySet().iterator(); i.hasNext();) { | |||||
Map.Entry entry = (Map.Entry) i.next(); | |||||
rc.setAttribute( | |||||
(String) entry.getKey(),(String) entry.getValue()); | |||||
} | |||||
rc.addText(getWrapper().getText().toString()); | |||||
return ret; | |||||
} | |||||
/** | /** | ||||
* Returns the name of the XML element which generated this unknown | * Returns the name of the XML element which generated this unknown | ||||
* element. | * element. | ||||
@@ -518,7 +544,10 @@ public class UnknownElement extends Task { | |||||
// backwards compatibility - element names of nested | // backwards compatibility - element names of nested | ||||
// elements have been all lower-case in Ant, except for | // elements have been all lower-case in Ant, except for | ||||
// TaskContainers | // TaskContainers | ||||
String childName = child.getTag().toLowerCase(Locale.US); | |||||
// This does not work too good for typedefed elements... | |||||
String childName = | |||||
ProjectHelper.genComponentName( | |||||
child.getNamespace(), child.getTag().toLowerCase(Locale.US)); | |||||
if (ih.supportsNestedElement(childName)) { | if (ih.supportsNestedElement(childName)) { | ||||
IntrospectionHelper.Creator creator = | IntrospectionHelper.Creator creator = | ||||
ih.getElementCreator(getProject(), parent, childName); | ih.getElementCreator(getProject(), parent, childName); | ||||
@@ -123,6 +123,11 @@ public class AddTypeTest extends BuildFileTest { | |||||
expectLogContaining( | expectLogContaining( | ||||
"myaddconfigured", "value is Value Setexecute: value is Value Set"); | "myaddconfigured", "value is Value Setexecute: value is Value Set"); | ||||
} | } | ||||
public void testNamespace() { | |||||
executeTarget("namespacetest"); | |||||
} | |||||
// The following will be used as types and tasks | // The following will be used as types and tasks | ||||
public static interface A {} | public static interface A {} | ||||