Browse Source
Fixed bug that caused MSBuild to compile one project several times (possibly even in parallel, thus failing the build). git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5642 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
14 changed files with 264 additions and 256 deletions
@ -1,101 +0,0 @@
@@ -1,101 +0,0 @@
|
||||
<Components version="1.0"> |
||||
<System.Windows.Forms.UserControl> |
||||
<Name value="ProjectAndSolutionOptionsPanel" /> |
||||
<ClientSize value="{Width=352, Height=324}" /> |
||||
<Controls> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject2" /> |
||||
<Location value="8, 8" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.SettingsGroupBox}" /> |
||||
<Size value="336, 104" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
<Controls> |
||||
<System.Windows.Forms.Button> |
||||
<Name value="selectProjectLocationButton" /> |
||||
<Location value="294, 32" /> |
||||
<Text value="..." /> |
||||
<Size value="32, 21" /> |
||||
<Anchor value="Top, Right" /> |
||||
<TabIndex value="6" /> |
||||
</System.Windows.Forms.Button> |
||||
<System.Windows.Forms.TextBox> |
||||
<Name value="projectLocationTextBox" /> |
||||
<TabIndex value="1" /> |
||||
<Location value="8, 32" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="280, 20" /> |
||||
</System.Windows.Forms.TextBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label" /> |
||||
<Location value="8, 16" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ProjectLocationLabel}" /> |
||||
<Size value="320, 16" /> |
||||
<TextAlign value="BottomLeft" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<TabIndex value="0" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="loadPrevProjectCheckBox" /> |
||||
<Location value="8, 56" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.LoadPrevProjectCheckBox}" /> |
||||
<TabIndex value="8" /> |
||||
<Size value="320, 32" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
<System.Windows.Forms.GroupBox> |
||||
<Name value="CreatedObject27" /> |
||||
<Location value="8, 128" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.BuildAndRunGroupBox}" /> |
||||
<Size value="336, 145" /> |
||||
<Anchor value="Top, Bottom, Left, Right" /> |
||||
<TabIndex value="1" /> |
||||
<Controls> |
||||
<System.Windows.Forms.ComboBox> |
||||
<Name value="onExecuteComboBox" /> |
||||
<TabIndex value="15" /> |
||||
<Location value="115, 92" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
<Size value="211, 21" /> |
||||
<FormattingEnabled value="True" /> |
||||
<DropDownStyle value="DropDownList" /> |
||||
</System.Windows.Forms.ComboBox> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label2" /> |
||||
<Location value="9, 95" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.WhenRunning}" /> |
||||
<Size value="100, 23" /> |
||||
<TabIndex value="14" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.NumericUpDown> |
||||
<Name value="parallelBuildNumericUpDown" /> |
||||
<Value value="1" /> |
||||
<TabIndex value="13" /> |
||||
<Minimum value="1" /> |
||||
<Location value="227, 66" /> |
||||
<Maximum value="16" /> |
||||
<Size value="49, 20" /> |
||||
</System.Windows.Forms.NumericUpDown> |
||||
<System.Windows.Forms.Label> |
||||
<Name value="label1" /> |
||||
<Location value="9, 68" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ParallelBuild}" /> |
||||
<Size value="212, 23" /> |
||||
<TextAlign value="TopRight" /> |
||||
<TabIndex value="12" /> |
||||
</System.Windows.Forms.Label> |
||||
<System.Windows.Forms.CheckBox> |
||||
<Name value="showErrorListCheckBox" /> |
||||
<Location value="8, 28" /> |
||||
<Text value="${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ShowErrorListPadCheckBox}" /> |
||||
<TabIndex value="10" /> |
||||
<Size value="320, 32" /> |
||||
<Anchor value="Top, Left, Right" /> |
||||
</System.Windows.Forms.CheckBox> |
||||
</Controls> |
||||
</System.Windows.Forms.GroupBox> |
||||
</Controls> |
||||
</System.Windows.Forms.UserControl> |
||||
</Components> |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
<gui:OptionPanel x:Class="ICSharpCode.SharpDevelop.Gui.OptionPanels.ProjectAndSolutionOptions" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:core="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:sd="clr-namespace:ICSharpCode.SharpDevelop" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui" |
||||
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"> |
||||
<StackPanel> |
||||
<GroupBox Header="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.SettingsGroupBox}"> |
||||
<StackPanel> |
||||
<Label Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ProjectLocationLabel}" |
||||
Target="{Binding ElementName=defaultProjectLocationTextBox}" /> |
||||
<DockPanel> |
||||
<Button Content="..." Click="defaultProjectLocationButtonClick" DockPanel.Dock="Right" /> |
||||
<TextBox Name="defaultProjectLocationTextBox" /> |
||||
</DockPanel> |
||||
<CheckBox Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.LoadPrevProjectCheckBox}" |
||||
IsChecked="{core:OptionBinding local:ProjectAndSolutionOptions.LoadPrevProjectAtStartup}" /> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
<GroupBox Header="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.BuildAndRunGroupBox}"> |
||||
<StackPanel> |
||||
<CheckBox Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ShowErrorListPadCheckBox}" |
||||
IsChecked="{core:OptionBinding project:BuildOptions.ShowErrorListAfterBuild}" /> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Label |
||||
Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.ParallelBuild}" |
||||
Target="{Binding ElementName=parallelBuildCount}" /> |
||||
<core:NumericUpDown Minimum="1" Maximum="16" Name="parallelBuildCount" Width="45" /> |
||||
</StackPanel> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Label |
||||
Content="Build Verbosity:" |
||||
Target="{Binding ElementName=verbosityComboBox}" /> |
||||
<ComboBox Name="verbosityComboBox" /> |
||||
</StackPanel> |
||||
<StackPanel Orientation="Horizontal"> |
||||
<Label |
||||
Content="{core:Localize Dialog.Options.IDEOptions.ProjectAndSolutionOptions.WhenRunning}" |
||||
Target="{Binding ElementName=onExecuteComboBox}" /> |
||||
<ComboBox Name="onExecuteComboBox" /> |
||||
</StackPanel> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.IO; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
||||
{ |
||||
public partial class ProjectAndSolutionOptions : OptionPanel |
||||
{ |
||||
public ProjectAndSolutionOptions() |
||||
{ |
||||
InitializeComponent(); |
||||
|
||||
FillComboBoxWithEnumValues(typeof(Project.BuildOnExecuteSetting), onExecuteComboBox); |
||||
FillComboBoxWithEnumValues(typeof(Project.BuildOutputVerbosity), verbosityComboBox); |
||||
} |
||||
|
||||
void FillComboBoxWithEnumValues(Type type, ComboBox comboBox) |
||||
{ |
||||
foreach (Project.BuildOnExecuteSetting element in Enum.GetValues(type)) { |
||||
object[] attr = type.GetField(Enum.GetName(type, element)).GetCustomAttributes(typeof(DescriptionAttribute), false); |
||||
string description; |
||||
if (attr.Length > 0) { |
||||
description = StringParser.Parse((attr[0] as DescriptionAttribute).Description); |
||||
} else { |
||||
description = Enum.GetName(type, element); |
||||
} |
||||
comboBox.Items.Add(description); |
||||
} |
||||
} |
||||
|
||||
void defaultProjectLocationButtonClick(object sender, RoutedEventArgs e) |
||||
{ |
||||
using (var fdiag = FileService.CreateFolderBrowserDialog("${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.SelectDefaultProjectLocationDialog.Title}", defaultProjectLocationTextBox.Text)) { |
||||
if (fdiag.ShowDialog() == System.Windows.Forms.DialogResult.OK) { |
||||
defaultProjectLocationTextBox.Text = fdiag.SelectedPath; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public override void LoadOptions() |
||||
{ |
||||
base.LoadOptions(); |
||||
defaultProjectLocationTextBox.Text = DefaultProjectCreationPath; |
||||
parallelBuildCount.Value = Project.BuildOptions.DefaultParallelProjectCount; |
||||
onExecuteComboBox.SelectedIndex = (int)Project.BuildModifiedProjectsOnlyService.Setting; |
||||
verbosityComboBox.SelectedIndex = (int)Project.BuildOptions.DefaultBuildOutputVerbosity; |
||||
} |
||||
|
||||
public override bool SaveOptions() |
||||
{ |
||||
// check for correct settings
|
||||
string projectPath = defaultProjectLocationTextBox.Text; |
||||
if (projectPath.Length > 0) { |
||||
if (!FileUtility.IsValidPath(projectPath)) { |
||||
MessageService.ShowError(StringParser.Parse("${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.InvalidProjectPathSpecified}")); |
||||
return false; |
||||
} |
||||
} |
||||
Project.BuildOptions.DefaultParallelProjectCount = (int)parallelBuildCount.Value; |
||||
Project.BuildModifiedProjectsOnlyService.Setting = (Project.BuildOnExecuteSetting)onExecuteComboBox.SelectedIndex; |
||||
Project.BuildOptions.DefaultBuildOutputVerbosity = (Project.BuildOutputVerbosity)verbosityComboBox.SelectedIndex; |
||||
return base.SaveOptions(); |
||||
} |
||||
|
||||
public static string DefaultProjectCreationPath { |
||||
get { |
||||
return PropertyService.Get("ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", |
||||
Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), |
||||
"SharpDevelop Projects")); |
||||
} |
||||
set { |
||||
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", value); |
||||
} |
||||
} |
||||
|
||||
public static bool LoadPrevProjectAtStartup { |
||||
get { |
||||
return PropertyService.Get("SharpDevelop.LoadPrevProjectOnStartup", false); |
||||
} |
||||
set { |
||||
PropertyService.Set("SharpDevelop.LoadPrevProjectOnStartup", value); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,81 +0,0 @@
@@ -1,81 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.IO; |
||||
using System.Windows.Forms; |
||||
|
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels |
||||
{ |
||||
public class ProjectAndSolutionOptionsPanel : XmlFormsOptionPanel |
||||
{ |
||||
public override void LoadPanelContents() |
||||
{ |
||||
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.ProjectAndSolutionOptionsPanel.xfrm")); |
||||
|
||||
// read properties
|
||||
ControlDictionary["projectLocationTextBox"].Text = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", |
||||
Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), |
||||
"SharpDevelop Projects")).ToString(); |
||||
|
||||
((CheckBox)ControlDictionary["loadPrevProjectCheckBox"]).Checked = PropertyService.Get("SharpDevelop.LoadPrevProjectOnStartup", false); |
||||
((CheckBox)ControlDictionary["showErrorListCheckBox"]).Checked = Project.BuildOptions.ShowErrorListAfterBuild; |
||||
((NumericUpDown)ControlDictionary["parallelBuildNumericUpDown"]).Value = Project.BuildOptions.DefaultParallelProjectCount; |
||||
|
||||
((Button)ControlDictionary["selectProjectLocationButton"]).Click += new EventHandler(SelectProjectLocationButtonClicked); |
||||
|
||||
ComboBox onExecuteComboBox = Get<ComboBox>("onExecute"); |
||||
Type type = typeof(Project.BuildOnExecuteSetting); |
||||
foreach (Project.BuildOnExecuteSetting element in Enum.GetValues(type)) { |
||||
object[] attr = type.GetField(Enum.GetName(type, element)).GetCustomAttributes(typeof(DescriptionAttribute), false); |
||||
string description; |
||||
if (attr.Length > 0) { |
||||
description = StringParser.Parse((attr[0] as DescriptionAttribute).Description); |
||||
} else { |
||||
description = Enum.GetName(type, element); |
||||
} |
||||
onExecuteComboBox.Items.Add(description); |
||||
} |
||||
onExecuteComboBox.SelectedIndex = (int)Project.BuildModifiedProjectsOnlyService.Setting; |
||||
} |
||||
|
||||
public override bool StorePanelContents() |
||||
{ |
||||
// check for correct settings
|
||||
string projectPath = ControlDictionary["projectLocationTextBox"].Text; |
||||
if (projectPath.Length > 0) { |
||||
if (!FileUtility.IsValidPath(projectPath)) { |
||||
MessageService.ShowError(StringParser.Parse("${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.InvalidProjectPathSpecified}")); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
// set properties
|
||||
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", projectPath); |
||||
PropertyService.Set("SharpDevelop.LoadPrevProjectOnStartup", ((CheckBox)ControlDictionary["loadPrevProjectCheckBox"]).Checked); |
||||
Project.BuildOptions.ShowErrorListAfterBuild = ((CheckBox)ControlDictionary["showErrorListCheckBox"]).Checked; |
||||
Project.BuildOptions.DefaultParallelProjectCount = (int)((NumericUpDown)ControlDictionary["parallelBuildNumericUpDown"]).Value; |
||||
|
||||
Project.BuildModifiedProjectsOnlyService.Setting = (Project.BuildOnExecuteSetting)Get<ComboBox>("onExecute").SelectedIndex; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
void SelectProjectLocationButtonClicked(object sender, EventArgs e) |
||||
{ |
||||
TextBox projectLocationTextBox = (TextBox)ControlDictionary["projectLocationTextBox"]; |
||||
using (FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog("${res:Dialog.Options.IDEOptions.ProjectAndSolutionOptions.SelectDefaultProjectLocationDialog.Title}", projectLocationTextBox.Text)) { |
||||
if (fdiag.ShowDialog() == DialogResult.OK) { |
||||
projectLocationTextBox.Text = fdiag.SelectedPath; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using Microsoft.Build.Framework; |
||||
using Microsoft.Build.Logging; |
||||
using System.IO; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Project |
||||
{ |
||||
sealed class BuildLogFileLogger : ConsoleLogger |
||||
{ |
||||
string fileName; |
||||
StreamWriter writer; |
||||
|
||||
public BuildLogFileLogger(string fileName, LoggerVerbosity verbosity) |
||||
: base(verbosity) |
||||
{ |
||||
this.fileName = fileName; |
||||
base.WriteHandler = Write; |
||||
} |
||||
|
||||
public override void Initialize(IEventSource eventSource) |
||||
{ |
||||
OpenFile(); |
||||
base.Initialize(eventSource); |
||||
} |
||||
|
||||
public override void Initialize(IEventSource eventSource, int nodeCount) |
||||
{ |
||||
OpenFile(); |
||||
base.Initialize(eventSource, nodeCount); |
||||
} |
||||
|
||||
void OpenFile() |
||||
{ |
||||
writer = new StreamWriter(fileName); |
||||
} |
||||
|
||||
public override void Shutdown() |
||||
{ |
||||
base.Shutdown(); |
||||
writer.Close(); |
||||
writer = null; |
||||
} |
||||
|
||||
void Write(string text) |
||||
{ |
||||
if (writer != null) |
||||
writer.Write(text); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision: 5529 $</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.IO; |
||||
using System.Text; |
||||
|
||||
using Microsoft.Build.Framework; |
||||
using Microsoft.Build.Logging; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Project |
||||
{ |
||||
sealed class SDConsoleLogger : ConsoleLogger |
||||
{ |
||||
IBuildFeedbackSink feedbackSink; |
||||
|
||||
public SDConsoleLogger(IBuildFeedbackSink feedbackSink, LoggerVerbosity verbosity) |
||||
: base(verbosity) |
||||
{ |
||||
if (feedbackSink == null) |
||||
throw new ArgumentNullException("feedbackSink"); |
||||
this.feedbackSink = feedbackSink; |
||||
this.ShowSummary = false; |
||||
base.WriteHandler = Write; |
||||
} |
||||
|
||||
StringBuilder buffer = new StringBuilder(); |
||||
|
||||
void Write(string text) |
||||
{ |
||||
// ReportMessage takes full lines, so we have to put stuff into a buffer until we get a whole line
|
||||
int sendUpTo = text.LastIndexOf('\n'); |
||||
int oldBufferLength = buffer.Length; |
||||
buffer.Append(text); |
||||
if (sendUpTo >= 0) { |
||||
sendUpTo += oldBufferLength; |
||||
Debug.Assert(buffer[sendUpTo] == '\n'); |
||||
int terminatorLength = 1; |
||||
if (sendUpTo > 0 && buffer[sendUpTo - 1] == '\r') { |
||||
sendUpTo--; |
||||
terminatorLength++; |
||||
} |
||||
feedbackSink.ReportMessage(buffer.ToString(0, sendUpTo)); |
||||
buffer.Remove(0, sendUpTo + terminatorLength); |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue