I guess this thread is a little long in the tooth now, but I thought I'd share my anecdote - Originally I too, found myself thinking it couldn't possibly be worth converting my beautifully scripted batch file to NAnt.  I also had a whole swag of environment variables that I had to manage in my batch file.

After some investigation, it didn't take me long to realise that NAnt was a great tool for builds.  Keeping my batch file neat and organised took a lot of effort (I really detest ms .bat files) whereas NAnt is inherently modular.  Furthermore, I found I no longer needed any of my crazy environment variables!  (Previously used to track build status, test status, build numbers, tool dirs etc...)  I was surprised to find my xml .build file was significantly smaller than my .bat file!  And it did more... I would disagree with the statement "Since NAnt is XML based, almost anything else will be more concise than a NAnt script."  For instance, NAnt's interfacing with NUnit is simpler than my batch scripting.  I found I no longer needed my kooky custom 'utility' programs since NAnt's feature set took care of these things (ie AssemblyInfo stamping)

And I just love the simplicity launching it from the command line.  My batch file was so completely unwieldy to test various parts, and diagnosing problems was a right pain.  Typing 'nant build', 'nant test', 'nant integrate' or whatever is just poetry.

Of course you'll have to do a bit of work to convert your build script, but definitely have a play, and see if you think it will be beneficial.  You may be pleasantly surprised.

Troy.


Ian MacLean wrote:
Grab a nightly build and use the brand new <setenv> task. It should do
exactly what you're after.
and the fact that .net 1.1 doesn't support setting vars is an omission
rather than security feature as .net 2.0 supports it.

as for why nant is better than batch :

- better error handling
- portability - probably not a big issue form the sounds of it.
- logging
- auto send of email on failure
- better flow control
- compiler tasks are smarter about when to re-compile or not - improving
build speed

There was a dr dobbs article a little while ago on using Ant for batch
processing tasks - personally I think NAnt is well suited for this kind
of thing as well as general build tasks. There is no getting around the
verbosity though - although using somthing like NAntPad might be a help.

Ian

Merrill Cornish wrote:

Someone in our group is trying to decide whether it would be worthwhile for him to convert a number of build batch files into NAnt 0.85.  He' grumbling about how much NAnt he has to write to dulicate the work now done by the batch files.  He's right, of course.  Since NAnt is XML based, almost anthing else will be more concise than a NAnt script.

What really worries/annoys him is NAnt's handling of environment variables.

The compile step in the current batch files typically require a group of environment variables to be set for things like include paths, lib paths, and so on.  In the batch file, all you have to do is several SET statements, followed by one or more compile steps.  Each compile step then sees the original group of environment  variables you set up.  For some compile steps, the evironment variables need to be changed, but  that's just a few more SET statements in the batch file.  Deleting an environment variable need by one step, but not the next, is also just a SET (to nothing).

In NAnt, setting up all of those environment variables seems to be a real pain.  As I understand, one of .NET's security features is that its API does not allow environment or registry variable to be set (although there are ways around that limitation at the programming level).

As far as I can tell, he would have to
* Set NAnt properties to the environment variable values from the current batch files.

* Use the <exec> task for each compile step.

* For each <exec>, use its <environment> nested element to specify the names of the environment variables the compile step needs, referencing the properties to get the values (rather than hard coding them into each call).

Among other things, this means that where one batch file SET statement would serve for any number of following compile steps, he would have to re-specify the whole set of enviroment variables for each <exec>.

So far, he's not really impressed with NAnt as a substitute for the current batch files.


My questions for any of you are:

*  Is there a better way in NAnt to getting the environment variables set for each <exec>?

*  What arguments can I use to show that despite its verbosity, NAnt is the better way to go anyway?

Merrill




-------------------------------------------------------
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_id=6595&alloc_id=14396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users
 




-------------------------------------------------------
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_id=6595&alloc_id=14396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


Reply via email to