bodewig 00/09/20 04:31:13
Modified: . build.xml
docs index.html
src/main/org/apache/tools/ant ProjectHelper.java
src/main/org/apache/tools/ant/taskdefs Ant.java
Log:
<ant> now copies the definitions of data types to the child project as
well.
Reported by: Jose Alberto Fernandez <[EMAIL PROTECTED]>
<ant> now checks it isn't calling the target it is nested into.
Submitted by: Nico Seessle <[EMAIL PROTECTED]>
Revision Changes Path
1.75 +4 -0 jakarta-ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/build.xml,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- build.xml 2000/09/18 14:05:42 1.74
+++ build.xml 2000/09/20 11:31:04 1.75
@@ -324,5 +324,9 @@
</junit>
</target>
+ <target name="testcall">
+ <antcall target="testcall" />
+ </target>
+
</project>
1.110 +2 -2 jakarta-ant/docs/index.html
Index: index.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/index.html,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- index.html 2000/09/20 11:13:57 1.109
+++ index.html 2000/09/20 11:31:09 1.110
@@ -5000,10 +5000,10 @@
registers a reference to this newly created task - at parser
time.</li>
- <li><code>init()</code> is called at parser time.</li>
-
<li>The task gets a reference to the target it belongs to via its
inherited <code>target</code> variable.</li>
+
+ <li><code>init()</code> is called at parser time.</li>
<li>All child elements of the XML element corresponding to this task
are created via this task's <code>createXXX()</code> methods or
1.31 +2 -1
jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
Index: ProjectHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ProjectHelper.java 2000/09/18 14:04:51 1.30
+++ ProjectHelper.java 2000/09/20 11:31:12 1.31
@@ -377,15 +377,16 @@
task.setLocation(new Location(buildFile.toString(),
locator.getLineNumber(), locator.getColumnNumber()));
configureId(task, attrs);
- task.init();
// Top level tasks don't have associated targets
if (target != null) {
task.setOwningTarget(target);
target.addTask(task);
+ task.init();
wrapper = task.getRuntimeConfigurableWrapper();
wrapper.setAttributes(attrs);
} else {
+ task.init();
configure(task, attrs, project);
task.execute();
}
1.18 +17 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
Index: Ant.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Ant.java 2000/09/18 07:54:59 1.17
+++ Ant.java 2000/09/20 11:31:13 1.18
@@ -141,9 +141,17 @@
p1.addTaskDefinition(taskName, taskClass);
}
+ Hashtable typedefs = project.getDataTypeDefinitions();
+ Enumeration e = typedefs.keys();
+ while (e.hasMoreElements()) {
+ String typeName = (String) e.nextElement();
+ Class typeClass = (Class) typedefs.get(typeName);
+ p1.addDataTypeDefinition(typeName, typeClass);
+ }
+
// set user-define properties
Hashtable prop1 = project.getProperties();
- Enumeration e = prop1.keys();
+ e = prop1.keys();
while (e.hasMoreElements()) {
String arg = (String) e.nextElement();
String value = (String) prop1.get(arg);
@@ -188,6 +196,14 @@
if (target == null) {
target = p1.getDefaultTarget();
+ }
+
+ // Are we trying to call the target in which we are defined?
+ if (p1.getBaseDir().equals(project.getBaseDir()) &&
+
p1.getProperty("ant.file").equals(project.getProperty("ant.file")) &&
+ target.equals(this.getOwningTarget().getName())) {
+
+ throw new BuildException("ant task calling it's own parent
target");
}
p1.executeTarget(target);