> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Ian MacLean > Sent: vrijdag 3 december 2004 3:58 > To: Troy Laurin > Cc: J. Christopher Six; [EMAIL PROTECTED] > Subject: Re: [Nant-users] Re: Segfault during compilation > with mono on Linux > > Troy Laurin wrote: > > > 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> > > > Since NAnt now does have expressions then that behaviour > doesn't make as > much sense. You can achieve the same thing by putting the if > test inside > the target. However with the current behaviour you *can't* > prevent both > a target and its dependencies from being executed just by > using the "if" > attribute. This seems like one case where diverging from Ants > behaviour > might not be a bad thing. Certainly the current behaviour > violates the > "principle of least suprise".
I understand, but it does make sense that dependencies can have influence on whether or not the target should be executed. Compatibility with Ant has never been a goal by itself, but we need very strong arguments if we intend to break compatibility with Ant (in one of the few where we ARE compattible ;-)) AND break backward compatibility for NAnt users. If we keep the current behaviour (which I'd prefer), then we should at least document it better, t make it more clear/obvious to users. Gert ------------------------------------------------------- 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