ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gle...@ca.ibm.com
Subject Re: [PATCH] Inheriting custom tasks in subprojects
Date Tue, 11 Jul 2000 18:05:21 GMT





Hmm...

Somthing went wrong when I pasted in the patch.  Lets try that again...

Index: jakarta-ant/src/main/org/apache/tools/ant/Project.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.28
diff -u -r1.28 Project.java
--- jakarta-ant/src/main/org/apache/tools/ant/Project.java
2000/07/09 03:48:11        1.28
+++ jakarta-ant/src/main/org/apache/tools/ant/Project.java
2000/07/11 17:09:21
@@ -214,6 +214,10 @@
     public Hashtable getUserProperties() {
         return userProperties;
     }
+
+    public Hashtable getTaskDefs() {
+        return taskClassDefinitions;
+    }

     public void setDefaultTarget(String defaultTarget) {
         this.defaultTarget = defaultTarget;
Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v

retrieving revision 1.9
diff -u -r1.9 Ant.java
--- jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
2000/07/11 11:14:48        1.9
+++ jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
2000/07/11 17:09:21
@@ -105,6 +105,14 @@
         }

         p1.init();
+
+        Hashtable taskdefs = project.getTaskDefs();
+        Enumeration et = taskdefs.keys();
+        while (et.hasMoreElements()) {();askDefs();fs/Ant.java
+          String taskName = (String) et.nextElement();
+          Class taskClass = (Class) taskdefs.get(taskName);
+          p1.addTaskDefinition(taskName, taskClass);
+        }

         // set user-define properties
         Hashtable prop1 = project.getProperties();

Glenn McAllister
TID - Software Developer - VisualAge for Java
IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey


Please respond to ant-dev@jakarta.apache.org

To:        ant-dev@jakarta.apache.org
cc:
Subject:        [PATCH] Inheriting custom tasks in subprojects



[IMAGE]




Hello all.

This patch lets sub builds called from the Ant task to inherit task
definitions as well as properties.  Its a usefull way to have a parent
build process define the custom tasks to be used by all sub builds.  Of
course, all this will be moot once Arnout has the new system ready, but
untill then this is a useful workaround.

Comments, anyone?

Index: jakarta-ant/src/main/org/apache/tools/ant/Project.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.28
diff -u -r1.28 Project.java
--- jakarta-ant/src/main/org/apache/tools/ant/Project.java
2000/07/09 03:48:11        1.28
+++ jakarta-ant/src/main/org/apache/tools/ant/Project.java
2000/07/11 17:09:21
@@ -214,6 +214,10 @@
     public Hashtable getUserProperties() {
         return userProperties;
     }
+
+    public Hashtable getTaskDefs() {
+        return taskClassDefinitions;
+    }

     public void setDefaultTarget(String defaultTarget) {
         this.defaultTarget = defaultTarget;
Index: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v

retrieving revision 1.9
diff -u -r1.9 Ant.java
--- jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
2000/07/11 11:14:48        1.9
+++ jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
2000/07/11 17:09:21
@@ -105,6 +105,14 @@
         }

         p1.init();
+
+        Hashtable taskdefs = project.getTaskDefs();
+        Enumeration et = taskdefs.keys();
+        while (et.hasMoreElements()) {();askDefs();fs/Ant.java
+          String taskName = (String) et.nextElement();
+          Class taskClass = (Class) taskdefs.get(taskName);
+          p1.addTaskDefinition(taskName, taskClass);
+        }

         // set user-define properties
         Hashtable prop1 = project.getProperties();


Glenn McAllister
TID - Software Developer - VisualAge for Java
IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey




(Embedded image moved to file: pic28549.pcx)

Mime
View raw message