DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28513>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28513

Ant executes targets that are dependencies of other targets which are not 
selected because of an "if" attribute.

           Summary: Ant executes targets that are dependencies of other
                    targets which are not selected because of an "if"
                    attribute.
           Product: Ant
           Version: 1.6.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If a target is not selected because of the "if" attribute, it's dependencies 
are still executed, even if there is no other reason to execute them.  Here is 
an example, with output also listed:

<project name="testif" default="good">
  <property name="property-that-is-set" value="true" />
  <target name="good" depends="notselected1,notselected2"/>
  <target name="notselected1" if="property-that-isnt-set" depends="bad-
target1">
    <echo message="shouldn't display this 1" />
  </target>
  <target name="notselected2" unless="property-that-is-set" depends="bad-
target2">
    <echo message="shouldn't display this 2" />
  </target>
  <target name="bad-target1">
    <echo message="bad target 1" />
  </target>
  <target name="bad-target2">
    <echo message="bad target 2" />
  </target>
</project>

Output:

[EMAIL PROTECTED] testant]$ ant -f build2.xml
Buildfile: build2.xml

bad-target1:
     [echo] bad target 1

notselected1:

bad-target2:
     [echo] bad target 2

notselected2:

good:

BUILD SUCCESSFUL
Total time: 0 seconds
[EMAIL PROTECTED] testant]$

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to