Hello:

The enclosed patch adds a new "inheritAll" attribute to the <ant> task.
The attribute defaults to "true" which preserves current behavior.
If set to "false," the only properties passed along to the sub-build
are userProperties (i.e., properties specified on the command line) and
properties specified within the actual <ant> call.

Please see my earlier message for more background information:
http://marc.theaimsgroup.com/?l=ant-dev&m=99323191628596&w=2 <http://marc.theaimsgroup.com/?l=ant-dev&m=99323191628596&w=2>


Thanks!

--Craeg

--
Craeg K. Strong | www.arielpartners.com
Ariel Partners LLC | [EMAIL PROTECTED] 85 River Street, Ste. 3A | Fax: (781) 647-9690
Waltham, MA 02453 | Voice: (781) 647-2425


Index: Ant.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.22
diff -u -r1.22 Ant.java
--- Ant.java    2001/03/12 09:22:04     1.22
+++ Ant.java    2001/06/28 01:09:53
@@ -83,10 +83,20 @@
     private String antFile = null;
     private String target = null;
     private String output = null;
+        private boolean inheritAll = true;
 
     Vector properties=new Vector();
     Project p1;
 
+    /**
+     * If true, inherit all properties from parent Project
+         * If false, inherit only userProperties and those defined
+         * inside the ant call itself
+     **/
+    public void setInheritAll(boolean inherit) {
+                inheritAll = inherit;
+    } //-- setInheritAll
+
     public void init() {
         p1 = new Project();
         p1.setJavaVersionProperty();
@@ -149,8 +159,12 @@
             p1.addDataTypeDefinition(typeName, typeClass);
         }
 
-        // set user-define properties
-        Hashtable prop1 = project.getProperties();
+        // set user-defined or all properties from calling project
+        Hashtable prop1;
+                 if (inheritAll == true)
+                         prop1 = project.getProperties();
+                 else
+                         prop1 = project.getUserProperties();
         e = prop1.keys();
         while (e.hasMoreElements()) {
             String arg = (String) e.nextElement();

Reply via email to