Modify

Ticket #186 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

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

Reported by: Bruce Weirdan Owned by: hans
Priority: major Milestone:
Component: documentation 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 Download (784 bytes) - added by Bruce Weirdan <weirdan@…> 4 years ago.

Change History

Changed 4 years ago by Bruce Weirdan <weirdan@…>

comment:1 Changed 4 years ago 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.

comment:2 Changed 3 years ago by hans

  • Status changed from new to assigned
  • Component changed from phing-core to documentation

We'll fix this at the documentation level.

comment:3 Changed 3 years ago by mrook

(In [457]) Refs #186 - clarify if/unless usage in targets

comment:4 Changed 3 years ago by mrook

  • Status changed from assigned to closed
  • Resolution set to fixed

This bug has been fixed in the SVN tree, revision r457.

Thank you for the report, and for helping us make Phing better!

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.