You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2001/12/12 10:31:51 UTC
cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs InputTest.java
bodewig 01/12/12 01:31:51
Modified: docs/manual/CoreTasks input.html
src/etc/testcases/taskdefs input.xml
src/main/org/apache/tools/ant/taskdefs Input.java
src/testcases/org/apache/tools/ant/taskdefs InputTest.java
Log:
remove exit ability from <input>
Revision Changes Path
1.2 +9 -21 jakarta-ant/docs/manual/CoreTasks/input.html
Index: input.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/input.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- input.html 2001/11/30 12:24:16 1.1
+++ input.html 2001/12/12 09:31:51 1.2
@@ -18,9 +18,6 @@
<p>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.</p>
-<p>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.</p>
<p>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 <a href="property.html">property task</a> which means that existing properties
@@ -38,11 +35,6 @@
<td valign="top" align="center">No</td>
</tr>
<tr>
- <td valign="top">exitmessage</td>
- <td valign="top">the exit message which gets displayed when exiting the build run.</td>
- <td valign="top" align="center">No</td>
- </tr>
- <tr>
<td valign="top">validargs</td>
<td valign="top">comma separated String containing valid input arguments. If set,
input task will reject any input not defined here and input task will
@@ -52,15 +44,6 @@
<td valign="top" align="center">No</td>
</tr>
<tr>
- <td valign="top">exitargs</td>
- <td valign="top">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.</td>
- <td valign="top" align="center">No</td>
- </tr>
- <tr>
<td valign="top">addproperty</td>
<td valign="top">the name of a property to be created from input. Behaviour is equal
to <a href="property.html">property task</a> which means that existing properties
@@ -79,12 +62,17 @@
/></pre>
<p>Will display the message "Press Return key to continue..." and pause
the build run until return key is pressed.</p>
-<pre> <input
+<pre>
+ <input
message="All data is going to be deleted from DB continue (y/n)?"
validargs="y,n"
- exitargs="n"
- exitmessage="Build abborted by user."
- /></pre>
+ addproperty="do.delete"
+ />
+ <condition propert="do.abort">
+ <equals arg1="n" arg2="${do.delete}" />
+ </condition>
+ <fail if="do.abort">Build abborted by user.</fail>
+</pre>
<p>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.".</p>
1.2 +0 -19 jakarta-ant/src/etc/testcases/taskdefs/input.xml
Index: input.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/input.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- input.xml 2001/11/30 12:24:16 1.1
+++ input.xml 2001/12/12 09:31:51 1.2
@@ -16,23 +16,13 @@
<input testinput="test"
message="All data is going to be deleted from DB continue (y/n)?"
validargs="y,n"
- exitargs="n"
/>
</target>
- <target name="test4">
- <input testinput="n"
- message="All data is going to be deleted from DB continue (y/n)?"
- validargs="y,n"
- exitargs="n"
- />
- </target>
-
<target name="test5">
<input testinput="y"
message="All data is going to be deleted from DB continue (y/n)?"
validargs="y,n"
- exitargs="n"
/>
</target>
@@ -43,13 +33,4 @@
/>
</target>
- <target name="test7">
- <input testinput="R"
- message="Press 'R' to make you very rich!"
- validargs="R"
- exitargs="R"
- exitmessage="Don't trust if you don't have the source ;-)"
- />
- </target>
-
</project>
1.3 +2 -37 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Input.java
Index: Input.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Input.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Input.java 2001/12/01 03:34:35 1.2
+++ Input.java 2001/12/12 09:31:51 1.3
@@ -69,8 +69,6 @@
*/
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 @@
* 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 @@
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 @@
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 @@
* Set a multiline message.
*/
public void addText(String msg) {
- message +=
- ProjectHelper.replaceProperties(project, msg);
+ message += project.replaceProperties(msg);
}
}
1.2 +0 -16 jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java
Index: InputTest.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/InputTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InputTest.java 2001/11/30 12:24:17 1.1
+++ InputTest.java 2001/12/12 09:31:51 1.2
@@ -88,18 +88,6 @@
}
}
- 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 @@
assertEquals("scott", project.getProperty("db.user"));
}
- public void test7() {
- expectBuildException("test7",
- "Don't trust if you don't have the source ;-)");
- }
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>