From ae4c060035da0be35697aa83807c5d8de0a9df6d Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 16 May 2003 09:22:29 +0000 Subject: [PATCH] Skip 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 --- WHATSNEW | 5 +++++ docs/manual/CoreTasks/input.html | 5 ++++- src/main/org/apache/tools/ant/taskdefs/Input.java | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/WHATSNEW b/WHATSNEW index 04a413545..e65f11bf5 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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 supposed to work with any version of VAJ starting with 3.0. +* 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: ----------- * Filter readers were not handling line endings properly. Bugzilla diff --git a/docs/manual/CoreTasks/input.html b/docs/manual/CoreTasks/input.html index 2f8580ab5..2209c6274 100644 --- a/docs/manual/CoreTasks/input.html +++ b/docs/manual/CoreTasks/input.html @@ -24,7 +24,10 @@ 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 cannot be overriden.

+task which means that existing properties cannot be overriden. +Since Ant 1.6, <input> 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).

Parameters

diff --git a/src/main/org/apache/tools/ant/taskdefs/Input.java b/src/main/org/apache/tools/ant/taskdefs/Input.java index 64d68dd20..be7d7643c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Input.java +++ b/src/main/org/apache/tools/ant/taskdefs/Input.java @@ -137,6 +137,12 @@ public class Input extends Task { * @exception 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; if (validargs != null) { Vector accept = StringUtils.split(validargs, ',');