Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Developers List »

Re: svn commit: r708930 - /ant/core/trunk/src/main/org/apache/tools/ant/Target.java

Dominique Devienne

2008-10-29

Replies: Find Java Web Hosting

Author LoginPost Reply
On Wed, Oct 29, 2008 at 11:27 AM, <mbenson@(protected):
> 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
> @@(protected) @@
>   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

> @@(protected) @@
> +     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: dev-unsubscribe@(protected)
For additional commands, e-mail: dev-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.