Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 94676 invoked by uid 500); 11 Sep 2002 14:35:39 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 94667 invoked by uid 500); 11 Sep 2002 14:35:39 -0000 Delivered-To: apmail-xml-axis-cvs@apache.org Date: 11 Sep 2002 14:35:38 -0000 Message-ID: <20020911143538.8897.qmail@icarus.apache.org> From: dims@apache.org To: xml-axis-cvs@apache.org Subject: cvs commit: xml-axis/java/xmls properties.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N dims 2002/09/11 07:35:38 Modified: java buildSamples.xml buildTest.xml java/tools/org/apache/axis/tools/ant/foreach ForeachTask.java java/xmls properties.xml Log: Added a "fork" option for ForEachTask to overcome memory problems. Revision Changes Path 1.12 +3 -7 xml-axis/java/buildSamples.xml Index: buildSamples.xml =================================================================== RCS file: /home/cvs/xml-axis/java/buildSamples.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- buildSamples.xml 5 Sep 2002 17:55:53 -0000 1.11 +++ buildSamples.xml 11 Sep 2002 14:35:38 -0000 1.12 @@ -110,7 +110,7 @@ - + @@ -126,13 +126,9 @@ - + - - - - - + 1.34 +5 -5 xml-axis/java/buildTest.xml Index: buildTest.xml =================================================================== RCS file: /home/cvs/xml-axis/java/buildTest.xml,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- buildTest.xml 9 Sep 2002 20:57:06 -0000 1.33 +++ buildTest.xml 11 Sep 2002 14:35:38 -0000 1.34 @@ -60,12 +60,12 @@ - + - + @@ -240,7 +240,7 @@ - + @@ -263,7 +263,7 @@ - + @@ -297,7 +297,7 @@ - + 1.4 +47 -10 xml-axis/java/tools/org/apache/axis/tools/ant/foreach/ForeachTask.java Index: ForeachTask.java =================================================================== RCS file: /home/cvs/xml-axis/java/tools/org/apache/axis/tools/ant/foreach/ForeachTask.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ForeachTask.java 10 Sep 2002 20:49:32 -0000 1.3 +++ ForeachTask.java 11 Sep 2002 14:35:38 -0000 1.4 @@ -55,9 +55,12 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.taskdefs.CallTarget; import org.apache.tools.ant.taskdefs.Property; import org.apache.tools.ant.taskdefs.Ant; +import org.apache.tools.ant.taskdefs.Java; import java.util.Enumeration; import java.util.Hashtable; @@ -89,12 +92,13 @@ * in ExecuteOn. It allows the user * to specify whether directories, files, or both directories and files * from the filesets are included as entries in the parameter set. - * + * * @author Tim Vernum * @author Davanum Srinivas */ public class ForeachTask extends Task { private Ant callee; + private Java callee2; private String subTarget; private Vector params; private Hashtable properties; @@ -102,6 +106,7 @@ private boolean inheritAll = true; // must match the default value of Ant#inheritRefs private boolean inheritRefs = false; + private boolean fork = false; public ForeachTask() { params = new Vector(); @@ -109,11 +114,6 @@ } public void init() { - callee = (Ant) getProject().createTask("ant"); - callee.setOwningTarget(getOwningTarget()); - callee.setTaskName(getTaskName()); - callee.setLocation(getLocation()); - callee.init(); } /** @@ -140,6 +140,15 @@ subTarget = target; } + /** + * If true, forks the javac compiler. + * + * @param f "true|false|on|off|yes|no" + */ + public void setFork(boolean f) { + fork = f; + } + public ParamSet createParam() { ParamSet param = new ParamSet(); params.addElement(param); @@ -151,13 +160,41 @@ } private void executeTarget() { - if (callee == null) { - init(); - } - if (subTarget == null) { throw new BuildException("Attribute target is required.", getLocation()); + } + if(fork) { + executeForkedAntTask(); + } else { + executeAntTask(); + } + } + + private void executeForkedAntTask() { + if (callee == null) { + callee2 = (Java) getProject().createTask("java"); + callee2.setOwningTarget(getOwningTarget()); + callee2.setTaskName(getTaskName()); + callee2.setLocation(getLocation()); + callee2.setClassname("org.apache.tools.ant.Main"); + callee2.setFork(true); + } + String systemClassPath = System.getProperty("java.class.path"); + callee2.setClasspath(new Path(getProject(), systemClassPath)); + String args = "-buildfile " + properties.get("file"); + Commandline.Argument arguments = callee2.createArg(); + arguments.setLine(args); + callee2.execute(); + } + + private void executeAntTask() { + if (callee == null) { + callee = (Ant) getProject().createTask("ant"); + callee.setOwningTarget(getOwningTarget()); + callee.setTaskName(getTaskName()); + callee.setLocation(getLocation()); + callee.init(); } callee.setAntfile(getProject().getProperty("ant.file")); 1.24 +1 -0 xml-axis/java/xmls/properties.xml Index: properties.xml =================================================================== RCS file: /home/cvs/xml-axis/java/xmls/properties.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- properties.xml 10 Sep 2002 18:56:52 -0000 1.23 +++ properties.xml 11 Sep 2002 14:35:38 -0000 1.24 @@ -93,3 +93,4 @@ +