D'oh!

Yes, of course. My brain must have been on vacation. (Mark it down as
having an interrupted night caused by my 1 month old daughter!) I hadn't
thought of doing an equality test checking for false. That's much
cleaner.

I didn't think you would need the .cs files included in the uptodate
test, since the csc task already knows that if the .cs files are later
than the output file a rebuild is required. Does it not work correctly
if you take that out?

(The reason I ask is that you may be extending your build time by
requesting a recompile - which will rebuild of all your .obj files, even
when it is not necessary).

Yes, absolutely you can use this technique for other tasks (I do). For
many of them you don't even need to use an "if" wrapper, you can use the
"if" or "unless" properties of the specific task.

Regards,
Richard

-----Original Message-----
From: Parag Chandra [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 09, 2005 11:42
To: Foster, Richard - PAL
Cc: nant-users@lists.sourceforge.net
Subject: RE: [Nant-users] How can I create a dependency on the .build
file itself?

Thanks Richard. Here's the modified solution I'm using (doesn't require
the extra rebuild.required property):

    <uptodate property="project.uptodate">
        <sourcefiles>
            <include name="**/*.cs"/>
            <include name="${project::get-buildfile-path()}"/>
        </sourcefiles>
        <targetfiles>
            <include name="${build.output_dir}\${build.output_file}"/>
        </targetfiles>
    </uptodate>

    <target name="build">
        <mkdir dir="${build.output_dir}"/>
        <csc target="library"
output="${build.output_dir}\${build.output_file}" debug="${build.debug}"
define="${build.defines}" filealign="4096"
rebuild="${project.uptodate=='False'}">
            <sources>
                <include name="**/*.cs"/>
            </sources>
            <references>
                <include name="${nant.dir}/bin/NAnt.Core.dll" />
            </references>
        </csc>
    </target>

This will work fine for csc tasks in particular; I guess to make it
generalized for any task I could surround the task with an <if> task?
Hope this helps someone else.


-------------------------------------------------------
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://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to