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 2009/02/27 22:11:35 UTC
DO NOT REPLY [Bug 46780] New: 's condition check is wrong
https://issues.apache.org/bugzilla/show_bug.cgi?id=46780
Summary: <target>'s condition check is wrong
Product: Ant
Version: 1.7.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: critical
Priority: P2
Component: Core
AssignedTo: notifications@ant.apache.org
ReportedBy: alekseyig@hotmail.com
CC: alekseyig@hotmail.com
if i have the following:
<target name='first' depends='second' if='some.condition.property'>
<echo> in first </echo>
</target>
<target name='second'>
<echo> in second </echo>
</target>
ant ignores the 'some.condition.property' check for target 'first' and
__always__ executes 'second' target and only after that execution it checks
condition property and based on it executes or not execute 'first' target.
I believe it is wrong, condition should define if execute 'first' target and
all its dependencies or not.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 46780] 's condition check is wrong
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46780
Matt Benson <gu...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Matt Benson <gu...@yahoo.com> 2009-02-27 21:49:52 PST ---
You have described the exact desired behavior of target dependencies. The
depended-upon target is executed first, then the condition is checked and the
depending target is executed if proper. This behavior has been intact in Ant
for many years--the intended pattern is that you should depend on a target
which runs a test to set the property that tells the "working" target whether
it should execute. Please correspond on user@ant.apache.org if you have
further questions about Ant usage.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 46780] 's condition check is wrong
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46780
alekseyig@hotmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |
--- Comment #2 from alekseyig@hotmail.com 2009-02-28 17:30:06 PST ---
Matt,
>>>... this behavior has been intact in Ant for many years...
yes, I know it, but it does not make it right.
Of cause, I oversimplified the case to make it clear what I am talking about.
Let me complicate it a lit bit more so you can see why I still think it is
wrong behavior and may be you can give me a solution for my problem.
Lets say I have many independent targets: target1, target2, ... targetN, and
they all do different but not simple tasks. Lets say I what to have combination
of them depending on some conditions, so I have the following:
<target name='first' depends='target1, target3, target4' if='some.condition1'>
<echo> in first </echo>
</target>
<target name='second' depends='target1, target3, target5' if='some.condition2'>
<echo> in second </echo>
</target>
<target name='third' depends='target3, target5' if='some.condition.3'>
<echo> in third </echo>
</target>
...
Do you see what I mean?
In such case, what would be the right approach to have different sets of
targets called in different conditions? <antcall> is what I have, __but__ I do
not want to use it, because it is evil. It does not keep track of dependencies
(you can create indefinite loop of targets using it :( )
Thank you.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 46780] 's condition check is wrong
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46780
--- Comment #3 from Matt Benson <gu...@yahoo.com> 2009-02-28 18:50:21 PST ---
I think we need still more information and the userlist is the proper place for
this discussion.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
DO NOT REPLY [Bug 46780] 's condition check is wrong
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46780
Stefan Bodewig <bo...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |INVALID
--- Comment #4 from Stefan Bodewig <bo...@apache.org> 2009-03-04 20:07:16 PST ---
Well, "this behavior has been intact in Ant for many years" *does* make it
right since it is the behavior that many many build files rely on.
something like
<target name="check-property">
<condition that may set property X .../>
</target>
<target name="do-something-if-X" if="X" depends="check-property">
...
</target>
<target name="do-something-unless-X" unless="X" depends="check-property">
...
</target>
<target name="do-something" depends="do-something-if-X,do-something-unless-X"/>
is a very common pattern which would be broken if we changed the behavior.
I know that other tools have taken a different approach (NAnt is one such
example, they use if/unless exactly the way you'd prefer it to work), but Ant's
behavior is known, documented and has been a conscious choice.
http://ant.apache.org/faq.html#stop-dependency
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.