You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2014/01/07 19:27:28 UTC
[Bug 55971] New: if:true doesn't work with macrodef
https://issues.apache.org/bugzilla/show_bug.cgi?id=55971
Bug ID: 55971
Summary: if:true doesn't work with macrodef
Product: Ant
Version: 1.9.3
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Core
Assignee: notifications@ant.apache.org
Reporter: mailforgilbert@gmx.de
Although release 1.9.3 fixed a bug related to the new if: and unless:
attributes (https://issues.apache.org/bugzilla/show_bug.cgi?id=55885) it seems
there are still some inconsistencies in that area.
Using if:true on macrodef doesn't work as expected
<project xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="foo" value="true"/>
<macrodef name="foobar">
<attribute name="bla"/>
<sequential>
<echo>@{bla}</echo>
</sequential>
</macrodef>
<echo>${ant.version}</echo>
<foobar bla="yada,yada" if:true="foo"/>
</project>
output, no error but macrodef doesn't get executed :
[echo] Apache Ant(TM) version 1.9.3 compiled on December 23 2013
BUILD SUCCESSFUL
Whereas when using if:true inside macrodef the macro
gets executed (but only when using if:true="${@{whentrue}}"
it doesn't work with if:true="@{whentrue}")
<project xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="foo" value="true"/>
<macrodef name="foobar">
<attribute name="bla"/>
<attribute name="whentrue"/>
<sequential>
<echo if:true="${@{whentrue}}">@{bla}</echo>
</sequential>
</macrodef>
<echo>${ant.version}</echo>
<foobar whentrue="foo" bla="yada,yada"/>
</project>
output :
[echo] Apache Ant(TM) version 1.9.3 compiled on December 23 2013
[echo] yada,yada
BUILD SUCCESSFUL
Regards, Gilbert
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 55971] if:true doesn't work with macrodef
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55971
Gilbert Rebhan <ma...@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Gilbert Rebhan <ma...@gmx.de> ---
Hello Antoine,
thanks for response. Yes, indeed it's a bit confusing -
and i already used the right syntax inside macrodef ;-)
<echo if:true="${@{whentrue}}">@{bla}</echo>
A hint in the documentation won't hurt.
<project xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="foo" value="on"/>
<macrodef name="foobar">
<attribute name="bla"/>
<sequential>
<echo>@{bla}</echo>
</sequential>
</macrodef>
<echo>${ant.version}</echo>
<foobar bla="yada,yada" if:true="${foo}"/>
</project>
running with Ant 1.9.1 :
[echo] Apache Ant(TM) version 1.9.1 compiled on May 15 2013
BUILD FAILED
c:\WKS\ant\tryme.xml:13: Unknown attribute [ant:if:if:true]
running with Ant 1.9.3 :
[echo] Apache Ant(TM) version 1.9.3 compiled on December 23 2013
[echo] yada,yada
BUILD SUCCESSFUL
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 55971] if:true doesn't work with macrodef
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55971
--- Comment #1 from Gilbert Rebhan <ma...@gmx.de> ---
Also this doesn't work :
<macrodef name="foobar" if:true="foo">
<attribute name="bla"/>
<sequential>
<echo>@{bla}</echo>
</sequential>
</macrodef>
<echo>${ant.version}</echo>
<foobar bla="yada,yada"/>
output :
... Problem: failed to create task or type foobar
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 55971] if:true doesn't work with macrodef
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55971
--- Comment #2 from Antoine Levy-Lambert <an...@apache.org> ---
Hello Gilbert,
I took a look at the documentation concerning these if:true ... attributes.
The documentation http://ant.apache.org/manual/ifunless.html gives examples
such as <foobar bla="yada,yada" if:true="${foo}"/>
so you have to dereference the property you want to use as a flag rather than
using the property name like in the if and unless attributes of targets. Sorry
maybe this is a bit confusing.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 55971] if:true doesn't work with macrodef
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55971
Gilbert Rebhan <ma...@gmx.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mailforgilbert@gmx.de
OS| |All
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 55971] if:true doesn't work with macrodef
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55971
--- Comment #4 from Gilbert Rebhan <ma...@gmx.de> ---
(In reply to Antoine Levy-Lambert from comment #2)
> I took a look at the documentation concerning these if:true ... attributes.
>
> The documentation http://ant.apache.org/manual/ifunless.html gives examples
> such as <foobar bla="yada,yada" if:true="${foo}"/>
P.S.
i see, documentation has been fixed for Ant 1.9.3
(https://issues.apache.org/bugzilla/show_bug.cgi?id=55359 ), so i didn't know
about that still using Ant 1.9.1
--
You are receiving this mail because:
You are the assignee for the bug.