[svn] r7622: vs-plugin/trunk/Nemerle.VsIntegration: NemerleConstants.cs Project/NemerleIdeBuildLogger.cs

VladD2 svnadmin at nemerle.org
Thu Apr 26 11:37:50 CEST 2007


Log:
1. Fix bug 963 (Warnings do not show in Output window).
see http://nemerle.org/bugs/view.php?id=963

Author: VladD2
Date: Thu Apr 26 11:37:48 2007
New Revision: 7622

Modified:
   vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
   vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleIdeBuildLogger.cs

Modified: vs-plugin/trunk/Nemerle.VsIntegration/NemerleConstants.cs
==============================================================================

Modified: vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleIdeBuildLogger.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleIdeBuildLogger.cs	(original)
+++ vs-plugin/trunk/Nemerle.VsIntegration/Project/NemerleIdeBuildLogger.cs	Thu Apr 26 11:37:48 2007
@@ -12,6 +12,7 @@
 using Microsoft.Win32;
 using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider;
 using Microsoft.VisualStudio;
+using System.Text.RegularExpressions;
 
 namespace Nemerle.VisualStudio.Project
 {
@@ -25,7 +26,7 @@
 		#region fields
 		// TODO: Remove these constants when we have a version that suppoerts 
 		//   getting the verbosity using automation.
-		private string _buildVerbosityRegistryRoot = @"Software\Microsoft\VisualStudio\8.0";
+		private string _buildVerbosityRegistryRoot;
 		private const string BuildVerbosityRegistrySubKey = @"General";
 		private const string BuildVerbosityRegistryKey = "MSBuildLoggerVerbosity";
 		// TODO: Re-enable this constants when we have a version that 
@@ -94,6 +95,15 @@
 		/// </summary>
 		public NemerleIdeBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy)
 		{
+			// HACK: We should use VS Automation for retrive root key!
+			Regex rx = new Regex(@"/rootsuffix\s+(.+)");
+			Match match = rx.Match(Environment.CommandLine);
+			if (match.Success)
+			{
+				_buildVerbosityRegistryRoot = @"Software\Microsoft\VisualStudio\8.0"
+					+ match.Groups[1].Value.Trim();
+			}
+
 			if (taskProvider == null)
 				throw new ArgumentNullException("taskProvider");
 			if (hierarchy == null)
@@ -167,8 +177,7 @@
 			TaskPriority priority = (errorEvent is BuildErrorEventArgs) 
 				? TaskPriority.High : TaskPriority.Normal;
 
-			if (OutputWindowPane != null 
-				&& (Verbosity != LoggerVerbosity.Quiet || errorEvent is BuildErrorEventArgs))
+			if (OutputWindowPane != null)
 			{
 				// Format error and output it to the output window
 				string message = FormatMessage(errorEvent.Message);
@@ -284,15 +293,8 @@
 		/// <param name="buildEvent"></param>
 		private void BuildFinishedHandler(object sender, BuildFinishedEventArgs buildEvent)
 		{
-			if (LogAtImportance(buildEvent.Succeeded 
-				? MessageImportance.Low : MessageImportance.High))
-			{
-				if (_outputWindowPane != null)
-					_outputWindowPane.OutputStringThreadSafe(Environment.NewLine);
-
 				LogEvent(sender, buildEvent);
 			}
-		}
 
 
 		/// <summary>
@@ -425,11 +427,29 @@
 				if (_currentIndent > 0)
 					msg.Append('\t', _currentIndent);
 
-				msg.AppendLine(buildEvent.Message);
+				string txt = buildEvent.Message.TrimEnd('.');
+
+				msg.AppendLine(txt + " -- " + TaskCount(TaskErrorCategory.Error) + " errors, "
+					+ TaskCount(TaskErrorCategory.Warning) + " warnings");
+
 				OutputWindowPane.OutputStringThreadSafe(msg.ToString());
 			}
 		}
 
+		int TaskCount(TaskErrorCategory type)
+		{
+			int count = 0;
+			foreach (object task in _taskProvider.Tasks)
+			{
+				ErrorTask err = task as ErrorTask;
+
+				if (err != null && err.ErrorCategory == type)
+					count++;
+			}
+
+			return count;
+		}
+
 		/// <summary>
 		/// This is called when the build complete.
 		/// </summary>
@@ -479,6 +499,8 @@
 		{
 			// TODO: This should be replaced when we have a version that supports automation.
 
+			string xxx = Environment.CommandLine;
+
 			string verbosityKey = String.Format(@"{0}\{1}", BuildVerbosityRegistryRoot, BuildVerbosityRegistrySubKey);
 			using (RegistryKey subKey = Registry.CurrentUser.OpenSubKey(verbosityKey))
 			{



More information about the svn mailing list