From 3bc4ba8e9cc0f7351ce3dcaa8e2df6133a13d9f1 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 19 Dec 2008 21:42:38 +0000 Subject: [PATCH] More debug info in BuildWorker; make FxCop auto-detection smarter. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3697 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Misc/CodeAnalysis/Src/FxCopWrapper.cs | 18 ++++++++++++++ .../ICSharpCode.Build.Tasks/Project/FxCop.cs | 24 ++++++++++++++++--- .../Project/SharpDevelop.CodeAnalysis.targets | 4 ++++ .../Interprocess/HostProcess.cs | 1 + .../Interprocess/WorkerProcess.cs | 3 ++- .../Program.cs | 3 ++- .../WorkerManager.cs | 2 ++ 7 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs b/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs index 25d1903e3a..44e27a73dc 100644 --- a/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs +++ b/src/AddIns/Misc/CodeAnalysis/Src/FxCopWrapper.cs @@ -88,6 +88,23 @@ namespace ICSharpCode.CodeAnalysis string fxCopPath = AnalysisIdeOptionsPanel.FxCopPath; if (string.IsNullOrEmpty(fxCopPath)) { // Code duplication: FxCop.cs in ICSharpCode.Build.Tasks + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\EDev")) { + if (key != null) { + fxCopPath = key.GetValue("FxCopDir") as string; + } + } + if (IsFxCopPath(fxCopPath)) { + return fxCopPath; + } + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\EDev")) { + if (key != null) { + fxCopPath = key.GetValue("FxCopDir") as string; + } + } + if (IsFxCopPath(fxCopPath)) { + return fxCopPath; + } + fxCopPath = FromRegistry(Registry.CurrentUser.OpenSubKey(@"Software\Classes\FxCopProject\Shell\Open\Command")); if (IsFxCopPath(fxCopPath)) { return fxCopPath; @@ -96,6 +113,7 @@ namespace ICSharpCode.CodeAnalysis if (IsFxCopPath(fxCopPath)) { return fxCopPath; } + return null; } else { if (IsFxCopPath(fxCopPath)) { return fxCopPath; diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs b/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs index 60ec6b2110..acb7ed64a5 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs +++ b/src/Libraries/ICSharpCode.Build.Tasks/Project/FxCop.cs @@ -163,12 +163,30 @@ namespace ICSharpCode.Build.Tasks string FindFxCopPath() { // Code duplication: FxCopWrapper.cs in CodeAnalysis addin - string fxCopPath = FromRegistry(Registry.CurrentUser.OpenSubKey(@"Software\Classes\FxCopProject\Shell\Open\Command")); - if (fxCopPath.Length > 0 && File.Exists(Path.Combine(fxCopPath, ToolName))) { + string fxCopPath = null; + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\EDev")) { + if (key != null) { + fxCopPath = key.GetValue("FxCopDir") as string; + } + } + if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { + return fxCopPath; + } + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\EDev")) { + if (key != null) { + fxCopPath = key.GetValue("FxCopDir") as string; + } + } + if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { + return fxCopPath; + } + + fxCopPath = FromRegistry(Registry.CurrentUser.OpenSubKey(@"Software\Classes\FxCopProject\Shell\Open\Command")); + if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { return fxCopPath; } fxCopPath = FromRegistry(Registry.ClassesRoot.OpenSubKey(@"FxCopProject\Shell\Open\Command")); - if (fxCopPath.Length > 0 && File.Exists(Path.Combine(fxCopPath, ToolName))) { + if (!string.IsNullOrEmpty(fxCopPath) && File.Exists(Path.Combine(fxCopPath, ToolName))) { return fxCopPath; } return null; diff --git a/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.CodeAnalysis.targets b/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.CodeAnalysis.targets index f3ea8d2cac..0850f89282 100644 --- a/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.CodeAnalysis.targets +++ b/src/Libraries/ICSharpCode.Build.Tasks/Project/SharpDevelop.CodeAnalysis.targets @@ -23,6 +23,10 @@ $(PrepareForRunDependsOn);SharpDevelopFxCopRun + + + + 0) { + Debug.WriteLine("WorkerManager: shutting down free worker"); DequeueFreeWorkerProcess().Shutdown(); } else { ClearLastBuildDoneTimer(); @@ -126,6 +127,7 @@ namespace ICSharpCode.SharpDevelop.BuildWorker public void RaiseError(string message) { + Debug.WriteLine(message); RaiseEvent(new BuildErrorEventArgs(null, null, null, -1, -1, -1, -1, message, null, "SharpDevelopBuildWorkerManager")); }