Hi, I don't think I really like adding a message attribute to the Task class, and having two ways of outputting messages to the build log.
The echo task is more powerful as it allows messages to be output only when a condition is met (separate from the task conditions), and it allows you to set a certain level (warning/info/...) for the message. Meaning you could reduce build output using commandline switches that limit build output to only a certain message level. Right now, you can choose to only output warning and error messages if that's all that is important for you. when we allow messages to be output by tasks themselves, the build output will get cluttered in some cases, and you'll have no way of filtering the output. Ofcourse you can add another attribute to the task for specifying the level of the message that should be output, but aren't we abusing the task here then ... The reason why Peter can't compile his changes is that adding a Message property to the Task base class would conflict with existing tasks that have a Message property (and/or build attribute). eg. EchoTask, FailTask, MailTask, ... Gert ----- Original Message ----- From: "Ian MacLean" <[EMAIL PROTECTED]> To: "Peter Lanoie" <[EMAIL PROTECTED]> Cc: "Nant-Users" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, August 01, 2003 5:36 AM Subject: [nant-dev] Re: [Nant-users] Idea: <task ... message="hello world" /> > Peter, > I like the idea. See what others say and then we can look at adding it. > Your approach looks pretty much correct. Don't know why you can't build > though. > > Ian > > >-- Part 1 -- > >Hi NAnters, > > > >I was just editing some build files and testing out some things. The > >thought occurred to me that certain tasks don't have as useful a message > >output as would sometimes be desired. Take the following task: > > > > <delete dir="c:\winnt" /> > > > >The typical output is: > > > > [delete] Deleting 1 directories. > > > >Wouldn't it be handy to be able to do this: > > > > <delete dir="c:\winnt" message="Deleting windows!!" /> > > > >...and get this... > > > > [delete] Task Message: Deleting windows!! > > [delete] Deleting 1 directories. > > > >...or some variation on this. > > > >Now before someone says "Just use <ECHO>!", let me point out that this would > >be applicable to the task itself such that it's also affected by task > >conditions: > > > > <delete dir="c:\winnt" message="Deleting windows!!" > >if="${meNotTooBright}" /> > > > >Not to mention that adding this one attribute to the task base class would > >be remarkably easy and thus globally available. > > > >-- Part 2 -- > >So I tried my hand at adding a "message" attribute to the Task class (using > >the 0.8.3-rc2 code) but I failed miserably. I'm not C#-enough (Get it? > >Sorry.) to figure out why it won't build (all kinds of reference errors > >which I can't seem to track down). So I figured I'd throw this up so that > >someone important who feels it's a good enough idea can put it in and make > >it actually work! > > > >Modifications to the Task base class (Task.cs): > > > >Added this var and property: > > > > string _message; > > > > /// <summary> > > /// Task specific message that is echoed if the task is executed. > >Default is blank. > > /// </summary> > > [TaskAttribute("message")] > > public string Message > > { > > get { return _message; } > > set { _message = value; } > > } > > > >Jammed this into public void Execute() right before ExecuteTask(); (approx > >line 145 in the code I had): > > > > if(_message != null){ > > Log(Level.Info, LogPrefix + "Task Message: " + _message); > > } > > > > > >This is only a suggestion. If someone actually DOES make this addition, feel > >free to make the log message show appropriately according to NAnt standards > >etc. Doesn't really matter to me what it looks like, just that a message is > >shown and obviously associated with the task. > > > >Thanks! > > > >Peter > > > > > > > > > >------------------------------------------------------- > >This SF.Net email sponsored by: Free pre-built ASP.NET sites including > >Data Reports, E-commerce, Portals, and Forums are available now. > >Download today and enter to win an XBOX or Visual Studio .NET. > >http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > >_______________________________________________ > >Nant-users mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/nant-users > > > > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 > _______________________________________________ > nant-developers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-developers > > ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users