Yes, yes there is. NAntContrib contains the record task. You could do
something like this.

<project>
    <property name='nant.onsuccess' value='onsuccess'/>
    <property name='nant.failure'  value='onfailure'/>
    <property name='logfile' value='build.log'/>
    <record name="${logfile}" action="Start"/>

    <target name="onfailure">
        <property name="status" value="bad"/>
        <call target="finish"/>
    </target>

    <target name="onsuccess">
        <property name="status" value="good"/>
        <call target="finish"/>
    </target>

    <target name="finish">
        <record name="${logfile}" action="Close"/>
        <mail
            from="[EMAIL PROTECTED]"
            tolist="[EMAIL PROTECTED]"
            cclist="[EMAIL PROTECTED]"
            bcclist="[EMAIL PROTECTED]"
            subject="Build Over: It went ${status}"
            message="See attached file for build log details."
            attachments="${logfile}"
            mailhost="smtpserver.anywhere.com"/>

    </target>
</project>

I hope this helps,
Scott

----- Original Message -----
From: "Thomas Bang Biilmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 07, 2003 12:22 AM
Subject: RE: [Nant-users] Send an email based on the Build Status


> Hi,
>
> Excellent stuff, these "success/failure" events... I'm just wondering:
>
> Is there any way to direct the nAnt build output to a text file that can
be included as the body with the "files="<build.log>"" mail task attribute?
A simple redirect won't do, since the log file will be open (and hence not
readable) when the mail task executes... If there no way to do this, I'll
just use the simple redirect to a log file, and then check that log file
when I receive a "Build failed" mail.



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to