This seems to be causing a lot of grief. I'm really leaning towards having a list of <param> elements at the project level and allowing those and only those values to be passed on the commandline. I'm not sure how feasible that would be with the way we pass properties to nested builds but I think it would simplfy things a lot and add extra benefits. For example:

<project name="foo" >
<param name="param1" default="somevalue" description="my first commandline param" />


...

params would be the equivalent of c#'s args[] array thats passed to main and similarly would be readonly. Because they are seperate from properties its clear that they have pass by value semantics. The default attribute allows you to use a default if a value isn't passed on the commandline without haveing to do the non-intuitive overwrite="false" mojo that is required now - similar to languages that allow default values for function paramaters. The description would be output when you do a nant -projecthelp further documenting the build file.

If you want a writable value based on a param you would set a new property - the same as you would in c# code with pass by value method arguments. Similarly it probably makes sense to have params and properties in the same namespace so you coulndn't create a property with the same name as an existing param.

Ian


Merrill Cornish wrote:

Unfortunately,  the property task's overwrite attribute can't overwrite a readonly 
property--according to the documentation.

So, if you are passing a command line argument into the NAnt 0.85 script and you want to munge that value internally, then you will have to create a second property initialized to the command line property value, then munger this second property.

Of course, if the command line argument wasn't specified, then you can detect that in 
the NAnt script with not property::exists('propertyName') then set propertyName to its 
default value.

Merrill


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users




--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to