Browse Source

Pass "FxCopDir" property to MSBuild.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2057 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
9353ae08e2
  1. 4
      src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin
  2. 23
      src/Main/Base/Project/Src/Project/MSBuildEngine.cs
  3. 74
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/AsynchronousWaitDialog.Designer.cs
  4. 72
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/AsynchronousWaitDialog.cs

4
src/AddIns/Misc/CodeAnalysis/CodeAnalysis.addin

@ -15,6 +15,10 @@ @@ -15,6 +15,10 @@
<String id="CodeAnalysis" text = "$(SharpDevelopBinPath)/SharpDevelop.CodeAnalysis.targets"/>
</Path>
<Path name = "/SharpDevelop/MSBuildEngine/AdditionalProperties">
<String id="FxCopDir" text = "${property:CodeAnalysis.FxCopPath}"/>
</Path>
<Path name = "/SharpDevelop/BackendBindings/ProjectOptions/AllManaged">
<DialogPanel id = "CodeAnalysis"
label = "${res:ICSharpCode.CodeAnalysis}"

23
src/Main/Base/Project/Src/Project/MSBuildEngine.cs

@ -27,6 +27,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -27,6 +27,11 @@ namespace ICSharpCode.SharpDevelop.Project
/// </summary>
public sealed class MSBuildEngine
{
const string CompileTaskNamesPath = "/SharpDevelop/MSBuildEngine/CompileTaskNames";
const string AdditionalTargetFilesPath = "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles";
const string AdditionalLoggersPath = "/SharpDevelop/MSBuildEngine/AdditionalLoggers";
const string AdditionalPropertiesPath = "/SharpDevelop/MSBuildEngine/AdditionalProperties";
/// <summary>
/// Gets a list of the task names that cause a "Compiling ..." log message.
/// You can add items to this list by putting strings into
@ -56,11 +61,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -56,11 +61,11 @@ namespace ICSharpCode.SharpDevelop.Project
static MSBuildEngine()
{
CompileTaskNames = new Set<string>(
AddInTree.BuildItems<string>("/SharpDevelop/MSBuildEngine/CompileTaskNames", null, false),
AddInTree.BuildItems<string>(CompileTaskNamesPath, null, false),
StringComparer.OrdinalIgnoreCase
);
AdditionalTargetFiles = AddInTree.BuildItems<string>("/SharpDevelop/MSBuildEngine/AdditionalTargetFiles", null, false);
AdditionalMSBuildLoggers = AddInTree.BuildItems<IMSBuildAdditionalLogger>("/SharpDevelop/MSBuildEngine/AdditionalLoggers", null, false);
AdditionalTargetFiles = AddInTree.BuildItems<string>(AdditionalTargetFilesPath, null, false);
AdditionalMSBuildLoggers = AddInTree.BuildItems<IMSBuildAdditionalLogger>(AdditionalLoggersPath, null, false);
MSBuildProperties = new SortedList<string, string>();
MSBuildProperties.Add("SharpDevelopBinPath", Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location));
@ -371,6 +376,18 @@ namespace ICSharpCode.SharpDevelop.Project @@ -371,6 +376,18 @@ namespace ICSharpCode.SharpDevelop.Project
foreach (KeyValuePair<string, string> entry in MSBuildProperties) {
engine.GlobalProperties.SetProperty(entry.Key, entry.Value);
}
// re-load these properties from AddInTree every time because "text" might contain
// SharpDevelop properties resolved by the StringParser (e.g. ${property:FxCopPath})
AddInTreeNode node = AddInTree.GetTreeNode(AdditionalPropertiesPath, false);
if (node != null) {
foreach (Codon codon in node.Codons) {
object item = codon.BuildItem(null, new System.Collections.ArrayList());
if (item != null) {
bool escapeValue = !codon.Properties.Get("text", "").Contains("$(");
engine.GlobalProperties.SetProperty(codon.Id, item.ToString(), escapeValue);
}
}
}
if (options.AdditionalProperties != null) {
foreach (KeyValuePair<string, string> entry in options.AdditionalProperties) {
engine.GlobalProperties.SetProperty(entry.Key, entry.Value);

74
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/AsynchronousWaitDialog.Designer.cs generated

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
namespace SearchAndReplace
{
partial class AsynchronousWaitDialog : System.Windows.Forms.Form
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(93, 23);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 23);
this.label1.TabIndex = 0;
this.label1.Text = "Please wait...";
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(12, 49);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(264, 23);
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
this.progressBar1.TabIndex = 1;
//
// AsynchronousWaitDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(288, 84);
this.ControlBox = false;
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "AsynchronousWaitDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AsynchronousWaitDialog";
this.ResumeLayout(false);
}
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label1;
}
}

72
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/AsynchronousWaitDialog.cs

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace SearchAndReplace
{
/// <summary>
/// Shows an wait dialog on a separate thread if the action takes longer than 200ms.
/// Usage:
/// using (AsynchronousWaitDialog.ShowWaitDialog()) {
/// long_running_action();
/// }
/// </summary>
public sealed partial class AsynchronousWaitDialog
{
class WaitHandle : IDisposable
{
bool disposed;
AsynchronousWaitDialog dlg;
[STAThread]
public void Run()
{
Thread.Sleep(500);
lock (this) {
if (disposed)
return;
dlg = new AsynchronousWaitDialog();
dlg.CreateControl();
}
Application.Run(dlg);
}
public void Dispose()
{
lock (this) {
disposed = true;
if (dlg != null) {
dlg.BeginInvoke(new MethodInvoker(dlg.Close));
}
}
}
}
public static IDisposable ShowWaitDialog()
{
WaitHandle h = new WaitHandle();
Thread thread = new Thread(h.Run);
thread.Name = "AsynchronousWaitDialog thread";
thread.Start();
Thread.Sleep(0); // allow new thread to start
return h;
}
private AsynchronousWaitDialog()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
}
}
}
Loading…
Cancel
Save