bodewig 00/09/04 06:19:55
Modified: src/main/org/apache/tools/ant ProjectHelper.java
src/main/org/apache/tools/ant/taskdefs Property.java
Taskdef.java
Log:
Make <taskdef> and <property> do their job in execute instead of
init. Call execute on tasks living outside of <target>s at parser time.
Revision Changes Path
1.25 +2 -0
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.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ProjectHelper.java 2000/08/22 15:38:32 1.24
+++ ProjectHelper.java 2000/09/04 13:19:53 1.25
@@ -360,6 +360,8 @@
if (target != null) {
task.setOwningTarget(target);
target.addTask(task);
+ } else {
+ task.execute();
}
}
1.13 +2 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
Index: Property.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Property.java 2000/08/03 02:36:25 1.12
+++ Property.java 2000/09/04 13:19:54 1.13
@@ -107,7 +107,7 @@
return resource;
}
- public void init() throws BuildException {
+ public void execute() throws BuildException {
try {
if ((name != null) && (value != null)) {
addProperty(name, value);
@@ -118,7 +118,7 @@
if (resource != null) loadResource(resource);
} catch (Exception e) {
- throw new BuildException(e);
+ throw new BuildException(e, location);
}
}
1.8 +3 -19
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java
Index: Taskdef.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Taskdef.java 2000/08/10 12:58:55 1.7
+++ Taskdef.java 2000/09/04 13:19:54 1.8
@@ -65,15 +65,9 @@
private String name;
private String value;
- //
- // REVISIT: Is this the right thing to do?
- // I moved the body of execute() into init().
- // - akv
- //
- public void init() throws BuildException {
- try {
+ public void execute() throws BuildException {
if (name==null || value==null ) {
- String msg = "name or class attributes of taskdef element "
+ String msg = "name or classname attributes of taskdef element "
+ "are undefined";
throw new BuildException(msg);
}
@@ -83,22 +77,12 @@
} catch (ClassNotFoundException cnfe) {
String msg = "taskdef class " + value +
" cannot be found";
- throw new BuildException(msg);
+ throw new BuildException(msg, location);
}
- } catch (Exception ex) {
- ex.printStackTrace();
- }
}
public void setName( String name) {
this.name = name;
- }
-
- public void XsetClass(String v) {
- log("The class attribute is deprecated. " +
- "Please use the classname attribute.",
- Project.MSG_WARN);
- value = v;
}
public String getClassname() {