RE: [nant-dev] IFTask PropertyMissing parameter?
Hi Kevin It's not user error, because my patch didn't make it into the CVS sources. We are still using a locally patched version of NAnt here. I would like to see the patch applied though, which is why I responded to the thread with my argument. In our patched version of NAnt, the properties are always passed as read-only properties. The basic reasoning for this is that the properties are presumably being passed to the child build file for a good reason, so the child should not be messing with their values. If you want to take a look at the patch, feel free to drop me an email direct. Mark -Original Message- From: Kevin Miller [mailto:[EMAIL PROTECTED]] Sent: 23 July 2002 15:40 To: 'Mark Griffiths'; 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? I agree with this pattern of build script development. If you are able to explicitly set properties of nant build tasks, which makes sense, then this is a user error on my part. I had no idea this was possible. The doc example does not indicate that property is a valid child element of the nant task. Is it always a valid child element? I did understand (from looking at source) that command line parameters are ReadOnly. Would it be possible to set declared properties ReadOnly via property attribute? I can see that being useful. Kevin Miller -Original Message- From: Mark Griffiths [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 23, 2002 3:28 AM To: 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? Kevin's requirements is exactly why I submitted the patch that allows properties to be explicitly passed to a build file. In the child build file, the properties become 'read-only' (as if passed using the -D:name=value command line parameter). This would allow you to write something like: main.build -- property name=debug value=false / nant buildfile=foo.build inheritall=false property name=debug value=$debug / /nant foo.build - !-- can be overriden by command line or calling build file -- property name=debug value=true / instead of: main.build -- property name=debug value=false / nant buildfile=foo.build inheritall=true / foo.build: -- ifnot propertyexists=debug property name=debug value=true / /ifnot I prefer the first way, since it fits with the declarative nature of NAnt. I also prefer the inputs to the child build file to be explicit, to avoid leaking properties accidentally.Not to mention compatibility (in spirit) with Ant, which I wrote about previously on this list. What does everybody else think? How long will it be before we have a switch/ task? Mark --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
RE: [nant-dev] IFTask PropertyMissing parameter?
Ah I see that NAnt does not allow it's properties to mutate at all. That simplifies things nicely. You are forced to make your tasks atomic. That would pretty much prevent me from doing what I want to do unless I had my tasks write information out to a temp file. I have to say I like the simplicity of the atomic operation. It is a slippery slope down the scripting language path. Kevin Miller -Original Message- From: Scott Hernandez [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:20 PM To: 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? I was kinda leaning towards an if with a not. It is a little more generic, and doesn't require us to add the negative condition to all the tests. -Original Message- From: Kevin Miller Sent: Monday, July 22, 2002 2:16 PM To: Nant-Developers (E-mail) Subject: [nant-dev] IFTask PropertyMissing parameter? Does anyone have a problem with adding a property to the If task allowing you to check to see if a property is missing? The reason I see the need for this is to test for negations. For instance if I use Nant to invoke a child build with inherit all. The childscript may not wish to override properties passed in by the parent. It can then test if the property is missing if propertymissing=debug property name=debug value=true / /if I understand you may not want NAnt to become a scripting language so if you have another suggestion to accomplish this please let me know. Kevin Miller --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
RE: [nant-dev] IFTask PropertyMissing parameter?
Ah, I see your point now. I do like that better as well. Kevin Miller -Original Message- From: Scott Hernandez [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:41 PM To: 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? I'm not sure why multiple logical checks are a problem. Maybe the simplest solution is to create an ifnot which is really the if task checking !condition(s). Here is the code. class IfNotTask : IfTask { protected override bool ConditionsTrue { return !base.ConditionsTrue; } } It would solve your problem by supplying the following syntax. ifnot propertyexits=debug/ -Original Message- From: [EMAIL PROTECTED] [mailto:nant-developers- [EMAIL PROTECTED]] On Behalf Of Kevin Miller Sent: Monday, July 22, 2002 2:28 PM To: 'Scott Hernandez'; 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? I agree with you there but the way If is implemented it considers all parameters for the condition. You could limit the task to accept only one logic parameter but then you are limiting its power. -Original Message- From: Scott Hernandez [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:20 PM To: 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? I was kinda leaning towards an if with a not. It is a little more generic, and doesn't require us to add the negative condition to all the tests. -Original Message- From: Kevin Miller Sent: Monday, July 22, 2002 2:16 PM To: Nant-Developers (E-mail) Subject: [nant-dev] IFTask PropertyMissing parameter? Does anyone have a problem with adding a property to the If task allowing you to check to see if a property is missing? The reason I see the need for this is to test for negations. For instance if I use Nant to invoke a child build with inherit all. The childscript may not wish to override properties passed in by the parent. It can then test if the property is missing if propertymissing=debug property name=debug value=true / /if I understand you may not want NAnt to become a scripting language so if you have another suggestion to accomplish this please let me know. Kevin Miller --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
RE: [nant-dev] IFTask PropertyMissing parameter?
Okay. The code is in cvs. -Original Message- From: [EMAIL PROTECTED] [mailto:nant-developers- [EMAIL PROTECTED]] On Behalf Of Kevin Miller Sent: Monday, July 22, 2002 2:52 PM To: 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? Ah, I see your point now. I do like that better as well. Kevin Miller -Original Message- From: Scott Hernandez [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 4:41 PM To: 'Nant-Developers (E-mail)' Subject: RE: [nant-dev] IFTask PropertyMissing parameter? I'm not sure why multiple logical checks are a problem. Maybe the simplest solution is to create an ifnot which is really the if task checking !condition(s). Here is the code. class IfNotTask : IfTask { protected override bool ConditionsTrue { return !base.ConditionsTrue; } } It would solve your problem by supplying the following syntax. ifnot propertyexits=debug/ --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ Nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers