diff --git a/WHATSNEW b/WHATSNEW index a4196b19d..5c32d82b9 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -148,7 +148,7 @@ Other changes: * New tasks , , , , , , , , , , , - , . + . * A new combined task, which replaces the old and tasks, has been added. The task, and diff --git a/docs/manual/CoreTasks/do.html b/docs/manual/CoreTasks/do.html deleted file mode 100644 index 3dcbfc68a..000000000 --- a/docs/manual/CoreTasks/do.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - -Do Task - - - - -

Do

-

Description

-

-This task is similar to the -<antcall> -task; however, <do> will not -re-run common dependencies. Using -<antcall> to run several targets that all have -the same dependency(s) will cause the dependent -target(s) for each called target to be run again. -This results in common targets, such as "init"-type targets, -being run many times. Using <do> -instead of <antcall> prevents any common dependencies -from being run more than once. -

-

-Note: The <do> task will still re-run -any dependent target that was run prior to the <do> task(s) -being run. - -

Parameters

- - - - - - - - - - - -
AttributeDescriptionRequired
targetThe target to run.Yes
- -

Examples

- -
-  <target name="all">
-    <do target="target1"/>
-    <do target="target2"/>
-  </target>
-
- -will run the targets target1 and target2. -If both target1 and target2 depend on, -for example, the init target, it will only be run once -rather than once for target1 and again for target2. - -
-

Copyright © 2002 Apache Software Foundation. -All rights Reserved.

- - - - diff --git a/docs/manual/coretasklist.html b/docs/manual/coretasklist.html index 5b96fa89f..aa8c41a0f 100644 --- a/docs/manual/coretasklist.html +++ b/docs/manual/coretasklist.html @@ -38,7 +38,6 @@ Deltree
Dependset
Dirname
-Do
Ear
Echo
Exec
diff --git a/docs/manual/tasksoverview.html b/docs/manual/tasksoverview.html index ac9e40d35..dba92cf24 100644 --- a/docs/manual/tasksoverview.html +++ b/docs/manual/tasksoverview.html @@ -389,12 +389,6 @@ documentation.

the target files, all the target files are removed.

- - Do -

Runs another target within the same buildfile, without - re-running any common dependent target(s).

- - Exec

Executes a system command. When the os attribute diff --git a/src/main/org/apache/tools/ant/taskdefs/Do.java b/src/main/org/apache/tools/ant/taskdefs/Do.java deleted file mode 100644 index 6f9e8bc0e..000000000 --- a/src/main/org/apache/tools/ant/taskdefs/Do.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.taskdefs; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Target; -import org.apache.tools.ant.Task; -import java.util.Enumeration; -import java.util.Hashtable; - -/* - * This task is similar to the task; however, will not - * re-evaluate all the dependencies of the specified target. Using - * to run several targets that all have the same dependency(s), for each - * called target, the dependent target(s) will be run again. This results - * in common targets, such as "init"-type targets, being run many times. - * Using instead of prevents any common dependencies from - * being run more than once. - * - * Note: The task will still re-run any dependent target that was run - * prior to the task(s) being run. - * - * Usage: - * - * - * - * - * - * - * - * @author Mark McMillan - * @author Diane Holt holtdl@apache.org - * (Clean-up for submission.) - * - * @since 1.5 - * - * @ant.task category="control" - * - */ - -public class Do extends Task { - - private String targetName; - - private static Hashtable hasRunList = new Hashtable(); - - public Do() { - } - - public void setTarget(String targetName) { - this.targetName = targetName; - } - - public void execute() throws BuildException { - // Get the target property - if (targetName == null) { - throw new BuildException("Missing 'target' attribute.", location); - } - - // This will cause all dependencies to be re-evaluated: - // project.executeTarget(targetName); - // so we don't want it. - runTarget(targetName); - } - - private void runTarget(String targetName) throws BuildException { - Target t = (Target)project.getTargets().get(targetName); - if (t == null) { - throw new BuildException("Target '" + targetName + "' not found.", - location); - } - - // Run all dependencies that have not yet been run before running - // the requested target. - Enumeration enum = t.getDependencies(); - while (enum.hasMoreElements()) { - String depName = (String)enum.nextElement(); - // This target has never been run - if (hasRunList.get(depName) == null) { - // Recursive call to run the dependent target - runTarget(depName); - } - } - - // Now run the requested target - log("Calling target '" + targetName + "'", Project.MSG_VERBOSE); - t.performTasks(); - - // Add to list of targets that have been run - hasRunList.put(targetName, t); - } - -}