J. Christopher Six wrote:
The "if" attribute definitely seems to be malfunctioning. Here is my test build:

    <project name="Test" default="test">
        <target name="dependency">
            <echo message="This is a dependency. You shouldn't see me
on Linux." />
        </target>
        <target name="test" depends="dependency" if="${platform::is-win32()}">
            <echo message="Is Win32: ${platform::is-win32()}" />
        </target>
    </project>


The results of running this on Gentoo:

    $nant test.build

    <...snipped irrelevant messages...>

    Target(s) specified: test

    dependency:

         [echo] This is a dependency. You shouldn't see me on Linux.

    BUILD SUCCEEDED

    Total time: 0.1 seconds.


This isn't a malfunction, at least if the behaviour is expected to be the same as Ant... Basically, the dependencies of a target are always run before testing the target's condition, because the dependencies may set up the condition.


This is a legacy of Ant not having expressions or an if statement, so the only way to conditionally perform tasks was via this depends/if mechanism:

<target name="foo" depends="foo-test" if="${foo-exists}">
  <do-foo />
</target>
<target name="foo-test">
  <available file="foo.txt" property="foo-exists" />
</target>


-T


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to