On Wed, Oct 29, 2008 at 11:27 AM, <[EMAIL PROTECTED]> wrote:
> allow custom propertyhelpers to supply a Boolean for Target if/unless as an
> alternative to specifying a property NAME
>
> Modified:
> ant/core/trunk/src/main/org/apache/tools/ant/Target.java
>
> ==============================================================================
> --- ant/core/trunk/src/main/org/apache/tools/ant/Target.java (original)
> +++ ant/core/trunk/src/main/org/apache/tools/ant/Target.java Wed Oct 29
> 09:27:00 2008
> @@ -347,30 +347,32 @@
> public void execute() throws BuildException {
> + if (!testIfAllows()) {
> project.log(this, "Skipped because property '" +
> project.replaceProperties(ifCondition)
> + "' not set.", Project.MSG_VERBOSE);
...
> + if (!testUnlessAllows()) {
> project.log(this, "Skipped because property '"
> + project.replaceProperties(unlessCondition) + "' set.",
> Project.MSG_VERBOSE);
The message is still using project.replaceProperties
> @@ -425,7 +427,7 @@
> + PropertyHelper propertyHelper =
> PropertyHelper.getPropertyHelper(getProject());
> + Object o = propertyHelper.parseProperties(ifCondition);
> + if (o instanceof Boolean) {
> + return ((Boolean) o).booleanValue();
> + }
> + return propertyHelper.getProperty(String.valueOf(o)) != null;
while the tests themselves no longer use project.replaceProperties,
but a different logic and possibly parsing.
So assuming a PropertyHelper accepts if="${verbose}==true" and returns
a Boolean when the verbose property looks like a boolean (on/off,
true/false, yes/no), and in this case verbose is no, then the verbose
log will read:
Skipped because property 'no==true' not set.
Which will be confusing. Sure, this is made up (I don't really know
when a PH will return a Boolean. Any example?), but I'm just trying to
point out there's a disconnect now between the evaluation of the
condition, and the verbose logging on that condition.
I'm not too sure how to "fix" it either. --DD
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]