diff --git a/docs/manual/CoreTasks/input.html b/docs/manual/CoreTasks/input.html index 43d98eb59..506162a25 100644 --- a/docs/manual/CoreTasks/input.html +++ b/docs/manual/CoreTasks/input.html @@ -18,9 +18,6 @@ or as character data nested into the element.

Optinonally a set of valid imput arguments can be defined via the validargs attribute. Input task will require the user to reenter values until the entered value matches one of the predefined.

-

Optionally a set of exit arguments can be defined via the exitargs attribute. -Input task will throw a BuildException with a customisable exit message if the -entered value matches one of the predefined.

Optionally a property can be created from the value entered by the user. This property can then be used during the following build run. Input behaves according to property task which means that existing properties @@ -37,11 +34,6 @@ cannot be overriden.

the Message which gets displayed to the user during the build run. No - - exitmessage - the exit message which gets displayed when exiting the build run. - No - validargs comma separated String containing valid input arguments. If set, @@ -51,15 +43,6 @@ cannot be overriden.

be accepted you will need to define both arguments within validargs. No - - exitargs - comma separated String containing exit arguments. If set, - input task will throw a BuildException with a customisable exit message if the - entered value matches to one of the predefined. Exitargs are compared case - sensitive. If you want 'x' and 'X' to end the build run you will need to define - both arguments within exitargs. - No - addproperty the name of a property to be created from input. Behaviour is equal @@ -79,12 +62,17 @@ the build run until return key is pressed.

/>

Will display the message "Press Return key to continue..." and pause the build run until return key is pressed.

-
  <input
+
+  <input
     message="All data is going to be deleted from DB continue (y/n)?"
     validargs="y,n"
-    exitargs="n"
-    exitmessage="Build abborted by user."
-  />
+ addproperty="do.delete" + /> + <condition propert="do.abort"> + <equals arg1="n" arg2="${do.delete}" /> + </condition> + <fail if="do.abort">Build abborted by user.</fail> +

Will display the message "All data is going to be deleted from DB continue (y/n)?" and require 'y+retrun key' to continue build or 'n+return key' to exit build with following message "Build abborted by user.".

diff --git a/src/etc/testcases/taskdefs/input.xml b/src/etc/testcases/taskdefs/input.xml index 3b3d53811..e9d3fcf0f 100644 --- a/src/etc/testcases/taskdefs/input.xml +++ b/src/etc/testcases/taskdefs/input.xml @@ -16,15 +16,6 @@ - - - - @@ -32,7 +23,6 @@ @@ -43,13 +33,4 @@ /> - - - - diff --git a/src/main/org/apache/tools/ant/taskdefs/Input.java b/src/main/org/apache/tools/ant/taskdefs/Input.java index 0e2587987..6277b2a66 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Input.java +++ b/src/main/org/apache/tools/ant/taskdefs/Input.java @@ -69,8 +69,6 @@ import org.apache.tools.ant.*; */ public class Input extends Task { private String validargs = null; - private String exitargs = null; - private String exitmessage = "Build abborted."; private String message = ""; private String addproperty = null; private String input = null; @@ -92,33 +90,12 @@ public class Input extends Task { * according to property task which means that existing properties * cannot be overriden. * - * @param exitargs Name for the property to be created from input + * @param addproperty Name for the property to be created from input */ public void setAddproperty (String addproperty) { this.addproperty = addproperty; } - /* - * Defines exit condition parameters as comma separated String. If input - * matches one of these input task will end build by throwing a - * BuildException. ExitArgs are case sensitive. If you want the build to - * end on 'x' and 'X' you need to define both values as exit arguments. - * - * @param exitargs A comma separated String defining exit arguments. - */ - public void setExitargs (String exitargs) { - this.exitargs = exitargs; - } - - /** - * Sets the ExitMessage which gets displayed when exiting the build run. - * Default is 'Build abborted.' - * @param exitmessage The exit message to be displayed. - */ - public void setExitmessage (String exitmessage) { - this.exitmessage = exitmessage; - } - /** * Sets the Message which gets displayed to the user during the build run. * @param message The message to be displayed. @@ -154,14 +131,6 @@ public class Input extends Task { accept.addElement(stok.nextToken()); } } - Vector exit = null; - if (exitargs != null) { - exit = new Vector(); - StringTokenizer stok = new StringTokenizer(exitargs, ",", false); - while (stok.hasMoreTokens()) { - exit.addElement(stok.nextToken()); - } - } log(message, Project.MSG_WARN); if (input == null) { try { @@ -193,9 +162,6 @@ public class Input extends Task { log("Override ignored for " + addproperty, Project.MSG_VERBOSE); } } - if (exit != null && exit.contains(input)) { - throw new BuildException(exitmessage); - } } // copied n' pasted from org.apache.tools.ant.taskdefs.Exit @@ -203,8 +169,7 @@ public class Input extends Task { * Set a multiline message. */ public void addText(String msg) { - message += - ProjectHelper.replaceProperties(project, msg); + message += project.replaceProperties(msg); } } diff --git a/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java b/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java index cda6f1953..54b697904 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java @@ -88,18 +88,6 @@ public class InputTest extends BuildFileTest { } } - public void test4() { - String log = "All data is going to be deleted from DB continue (y/n)?"; - String message = "Build abborted."; - try { - executeTarget("test4"); - } catch (org.apache.tools.ant.BuildException e) { - String realLog = getLog(); - assertEquals(log, realLog); - assertEquals(message, e.getMessage()); - } - } - public void test5() { expectLog("test5", "All data is going to be deleted from DB continue (y/n)?"); @@ -111,8 +99,4 @@ public class InputTest extends BuildFileTest { assertEquals("scott", project.getProperty("db.user")); } - public void test7() { - expectBuildException("test7", - "Don't trust if you don't have the source ;-)"); - } }