Title: RE: [nant-dev] Possible bug calling the same target more than once

That's a good point, targets really aren't subroutines, but shouldn't there be a way to call a reusable chunk of build code from within a given target. 

Does Ant have anything like a subroutine task? I'm not sure b/c this is my first exposure to Nant/Ant?  If not, is it worth writing a task that acts like a sub?  I'm thinking so (mainly because the design of a build file I'm working on right now dictates this =)

I'm really interested in the Nant communities input on this...

Don


-----Original Message-----
From: Brad Wilson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 16, 2002 6:26 PM
To: NAnt Developers
Subject: Re: [nant-dev] Possible bug calling the same target more than once


Browning, Don wrote:

> [...] the first time I run the target everything executes fine, but
> the second time I call that same target, nothing happens.

I believe this to be by design. I ran into this too, but didn't send an e-mail, for the simple reason that I decided I was using NAnt in a way that it was not (and should not be) designed for.

The difference is between that of "target" and "subroutine". In our desired use, we're treating it like a subroutine, but it's not. Targets should build their results and be done. If something else requires a target that's already built, it shouldn't get built again. NAnt keeps track of this, and your second call is "ignored" (that target has already been built).

The solution I chose was to a second build file, and instead invoke that with command line arguments that told the second build file exactly what it was doing. This works perfectly.

Brad

--
Read my web log at http://www.quality.nu/dotnetguy/


_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________

Nant-developers mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to