Browse Source

Skip <input> if it is asked to set a property that has already been set.

PR: 19967


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274585 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
ae4c060035
3 changed files with 15 additions and 1 deletions
  1. +5
    -0
      WHATSNEW
  2. +4
    -1
      docs/manual/CoreTasks/input.html
  3. +6
    -0
      src/main/org/apache/tools/ant/taskdefs/Input.java

+ 5
- 0
WHATSNEW View File

@@ -34,6 +34,11 @@ Changes that could break older environments:
now - and we'd like to know about it. The current set of tasks is now - and we'd like to know about it. The current set of tasks is
supposed to work with any version of VAJ starting with 3.0. supposed to work with any version of VAJ starting with 3.0.


* <input> will no longer prompt the user and wait for input if the
addproperty attribute is set to a property that has already been
defined in the project. If you rely on the task waiting for input,
don't use the addproperty attribute.

Fixed bugs: Fixed bugs:
----------- -----------
* Filter readers were not handling line endings properly. Bugzilla * Filter readers were not handling line endings properly. Bugzilla


+ 4
- 1
docs/manual/CoreTasks/input.html View File

@@ -24,7 +24,10 @@ one of the predefined.</p>
<p>Optionally a property can be created from the value entered by the <p>Optionally a property can be created from the value entered by the
user. This property can then be used during the following build user. This property can then be used during the following build
run. Input behaves according to <a href="property.html">property run. Input behaves according to <a href="property.html">property
task</a> which means that existing properties cannot be overriden.</p>
task</a> which means that existing properties cannot be overriden.
Since Ant 1.6, <code>&lt;input&gt;</code> will not prompt for input if
a property should be set by the task that has already been set in the
project (and the task wouldn't have any effect).</p>


<h3>Parameters</h3> <h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0"> <table border="1" cellpadding="2" cellspacing="0">


+ 6
- 0
src/main/org/apache/tools/ant/taskdefs/Input.java View File

@@ -137,6 +137,12 @@ public class Input extends Task {
* @exception BuildException * @exception BuildException
*/ */
public void execute () throws BuildException { public void execute () throws BuildException {
if (addproperty != null
&& getProject().getProperty(addproperty) != null) {
log("skipping " + getTaskName() + " as property " + addproperty
+ " has already been set.");
}

InputRequest request = null; InputRequest request = null;
if (validargs != null) { if (validargs != null) {
Vector accept = StringUtils.split(validargs, ','); Vector accept = StringUtils.split(validargs, ',');


Loading…
Cancel
Save