I have a custom user task working pretty well but I have one other tweak I'd like to make. I've noticed that ExecuteTask returns void so I wasn't exactly how to signal NAnt if my task failed. I had assumed that it would be bad to throw an exception from ExecuteTask so the only other thing I could think of was to set a property at run time that would gate the rest of my build. Here's what I've got:

 

 

<?xml version="1.0"?>

<project name="NPD Master" default="makefile-run">

           

            <property name="force" value="false"/>

 

            <property name="makefiletask-ok" value="false"/>

 

            <target name="makefile-rebuild">

                        <makefiletask makefile="makefile.xml" marker="makefile-norebuild" force="${force}" mask="deps*.xml" signalproperty="makefiletask-ok"/>

            </target>

 

            <target name="makefile-run" depends="makefile-rebuild">

                        <nant if="${makefiletask-ok}" buildfile="makefile.xml"/>

            </target>

 

           

</project>

 

Note that I define a property called "makefiletask-ok". I pass the name of this property into the my task at runtime. My task sets this propery to true or false depending on whether it worked or not. Then I gate the rest of my build using the "if" clause:

 

<nant if="${makefiletask-ok}" buildfile="makefile.xml"/>

 

 

The down side to this approach is even when my task fails NAnt still ends with the message "BUILD SUCCEEDED" (but properly skips the rest of the build).

 

If anyone has some ideas I'd love some help.

 

 

James Lewis

[EMAIL PROTECTED]

480-308-3491 (w)

480-242-9632 (c)

 

JDA Software Group, Inc.

14400 North 87th Street

Scottsdale, AZ  85260-3649

 

<<attachment: image001.gif>>

Reply via email to