Title: RE: [Nant-users] Interim state on a build between SUCCEEDED and FAILED
Thanks for that Henry,
 
It's not quite what I want to do, but it has given me a couple of ideas.  Your idea of defining a property is good, I can do this inside my task and add or modify the property on the project then access it from the build script at the end to print the message.  The only problem is that I have a controlling project that runs the projects for each individual component to be built, and the property only gets set on the nested project.  This doesn't appear to have a parent property on the project class.  Does it have any concept of a parent in code?  If so, does anyone know how to access it?
 
The second approach that occured to me would be to use a similar approach but store the errors in a static member in my task and then have an optional attribute to the task that triggered a dump of the contents.  Does anyone know if the <nant> task within nant creates a new process or do all instances run in the same process?  I know in Ant you could specify "fork" which would run the nested Ant instance in a new instance of the JVM.  If so, that would preclude using static data, but if they all run in the same process then I could get away with it.
 
Cheers,
 
Bill

 
 -----Original Message-----
From: Price, Henry [mailto:[EMAIL PROTECTED]
Sent: 13 May 2004 16:14
To: Bill Martin; [EMAIL PROTECTED]
Subject: RE: [Nant-users] Interim state on a build between SUCCEEDED and FAILED

I've worked around a similar problem which relates to the success of Nunit tests (amongst other things) based on external sources. We have no control over them, so they are prone to fail which would normally cause the build to fail entirely. In this case, we may be aware that the external sources are down, but still want the build to run (entirely) without just failing.

Without going into huge detail, the way I do most of it is with a combination of the <exec> task (to run the Nunit tests - gives a bit more control than the Nant task) and several generous chunks of C# script. The tests are run and output XML, some C# script then runs against that XML looking for failures and stores the result in a Nant property. The <exec> task has failonerror="false" so the build will continue regardless of failures.

As the last task in the build, it looks at a number of such properties (this can be applied to template checking, Ndoc generation, FXCop etc) and then I have another little piece of C# script which then writes a summary report (something like 'Build Succeeded, but the following external tests failed ... There were the following warnings...' etc. You can also use a conditional <fail> task to fail things deliberately at the end if you decide it's all gone too wrong.

This is fine for a non-release candidate, the scripts also check for this, and are a lot more rigid in what passes and gets versioned and packaged for release.

Sorry if that's a bit vague - hope it helps :)



______________________________________________________________

CONFIDENTIALITY NOTICE

This communication and the information it contains is intended for the person or organisation to
whom it is addressed. Its contents are confidential and may be protected in law. Unauthorised use,
copying or disclosure of any of it may be unlawful. If you are not the intended recipient, please
contact us immediately.

The contents of any attachments in this e-mail may contain software viruses, which could damage your
own computer system. While Marlborough Stirling has taken every reasonable precaution to minimise
this risk, we cannot accept liability for any damage, which you sustain as a result of software
viruses. You should carry out your own virus checking procedure before opening any attachment.


Marlborough Stirling plc, Registered in England and Wales
Registered No. 3008820,
Allen Jones House, Jessop Avenue, Cheltenham, Gloucestershire, GL50 3SH
Tel: 01242 547000 Fax: 01242 547100
http://www.marlborough-stirling.com

Reply via email to