Ticket #186 (new defect)

Opened 8 months ago

Last modified 1 month ago

targets are executed even if the target that depend on them is skipped using if/unless

Reported by: Bruce Weirdan Assigned to: hans
Priority: major Milestone:
Component: phing-core Version: devel
Keywords: Cc:

Description

Either it's not clear from the documentation or is a bug: when I have conditional target (using "if"/"unless" attribute) and target is not to be executed due to the failed condition, the targets listed in its "depends" are still executed.

Test case: see attached file. What I expect is that path2-prereq target should be skipped, but it's still executed, even though the target that triggered it execution is not.

Attachments

phing.bug186.xml (0.8 kB) - added by Bruce Weirdan <weirdan@gmail.com> on 11/12/07 12:16:49.

Change History

11/12/07 12:16:49 changed by Bruce Weirdan <weirdan@gmail.com>

  • attachment phing.bug186.xml added.

05/29/08 06:06:09 changed by bender

My vote is that the documentation needs to be updated. Phing is basically a port/clone of Apache Ant and the Ant user manual is clear on the subject:

Important: the if and unless attributes only enable or disable the target to which they are attached. They do not control whether or not targets that a conditional target depends upon get executed. In fact, they do not even get evaluated until the target is about to be executed, and all its predecessors have already run.

http://ant.apache.org/manual/using.html#targets

This behavior is fairly fundamental to the circular reference and dependency resolution. As pointed out in the same Ant manual page, using a dependent task to set a property is also the only way to accomplish a compound if or unless conditional check.


Add/Change #186 (targets are executed even if the target that depend on them is skipped using if/unless)