Browse Source

Hide MSBuildEngine behind service interface and move it to SharpDevelop.exe

pull/32/merge
Daniel Grunwald 13 years ago
parent
commit
9ee497eec8
  1. 14
      src/AddIns/Analysis/CodeAnalysis/Src/FxCopLogger.cs
  2. 6
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs
  3. 1
      src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj
  4. 39
      src/AddIns/BackendBindings/Scripting/Test/Utils/MSBuildEngineHelper.cs
  5. 7
      src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs
  6. 7
      src/AddIns/BackendBindings/WixBinding/Test/Project/GetPreprocessorVariableValueTests.cs
  7. 6
      src/AddIns/BackendBindings/WixBinding/Test/Utils/WixBindingTestsHelper.cs
  8. 72
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  9. 9
      src/Main/Base/Project/Project/Build/BuildError.cs
  10. 168
      src/Main/Base/Project/Project/Build/IMSBuildEngine.cs
  11. 0
      src/Main/Base/Project/Project/Configuration/ConfigurationAndPlatform.cs
  12. 0
      src/Main/Base/Project/Project/Configuration/IConfigurable.cs
  13. 0
      src/Main/Base/Project/Project/Configuration/IConfigurationMapping.cs
  14. 0
      src/Main/Base/Project/Project/Configuration/IConfigurationOrPlatformNameCollection.cs
  15. 4
      src/Main/Base/Project/Project/ISolution.cs
  16. 0
      src/Main/Base/Project/Project/PortableLibrary/CheckPortableLibraryInstalled.cs
  17. 0
      src/Main/Base/Project/Project/PortableLibrary/ConvertToPortableLibraryProjectBehavior.cs
  18. 0
      src/Main/Base/Project/Project/PortableLibrary/PickPortableTargetFramework.cs
  19. 0
      src/Main/Base/Project/Project/PortableLibrary/PortableLibraryProjectBehavior.cs
  20. 0
      src/Main/Base/Project/Project/PortableLibrary/PortableTargetFramework.cs
  21. 2
      src/Main/Base/Project/Project/PortableLibrary/Profile.cs
  22. 0
      src/Main/Base/Project/Project/PortableLibrary/ProfileList.cs
  23. 0
      src/Main/Base/Project/Project/PortableLibrary/SelectProfileDialog.xaml
  24. 0
      src/Main/Base/Project/Project/PortableLibrary/SelectProfileDialog.xaml.cs
  25. 0
      src/Main/Base/Project/Project/PortableLibrary/SupportedFramework.cs
  26. 18
      src/Main/Base/Project/Services/IUIService.cs
  27. 10
      src/Main/Base/Project/Services/SD.cs
  28. 6
      src/Main/Base/Project/Src/Commands/BuildCommands.cs
  29. 4
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
  30. 120
      src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/AddNewConfigurationDialog.resx
  31. 3
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs
  32. 2
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionItemNode.cs
  33. 30
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  34. 2
      src/Main/Base/Project/Src/Project/MSBuildFileProject.cs
  35. 147
      src/Main/Base/Project/Src/Project/MSBuildInternals.cs
  36. 25
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  37. 1
      src/Main/Core/Project/ICSharpCode.Core.csproj
  38. 15
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
  39. 24
      src/Main/Core/Project/Src/Util/CommandWrapper.cs
  40. 2
      src/Main/Core/Project/Src/Util/WeakCollection.cs
  41. 2
      src/Main/SharpDevelop/Project/Build/BuildModifiedProjectsOnlyService.cs
  42. 0
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/BuildWorkerManager.cs
  43. 222
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngine.cs
  44. 184
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngineWorker.cs
  45. 32
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildLoggerFilter.cs
  46. 0
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/SDConsoleLogger.cs
  47. 6
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/TargetingPackWarningWorkaround.cs
  48. 24
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/TaskBoundAdditionalLoggerDoozer.cs
  49. 0
      src/Main/SharpDevelop/Project/Build/MSBuildEngine/WorkerProcess.cs
  50. 2
      src/Main/SharpDevelop/Project/Configuration/AddNewConfigurationDialog.Designer.cs
  51. 4
      src/Main/SharpDevelop/Project/Configuration/AddNewConfigurationDialog.cs
  52. 0
      src/Main/SharpDevelop/Project/Configuration/ConfigurationMapping.cs
  53. 2
      src/Main/SharpDevelop/Project/Configuration/EditAvailableConfigurationsDialog.Designer.cs
  54. 4
      src/Main/SharpDevelop/Project/Configuration/EditAvailableConfigurationsDialog.cs
  55. 2
      src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationEditor.Designer.cs
  56. 12
      src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationEditor.cs
  57. 0
      src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationOrPlatformNameCollection.cs
  58. 3
      src/Main/SharpDevelop/Project/Solution.cs
  59. 1
      src/Main/SharpDevelop/Sda/CallHelper.cs
  60. 11
      src/Main/SharpDevelop/Sda/SharpDevelopHost.cs
  61. 23
      src/Main/SharpDevelop/Services/UIService.cs
  62. 40
      src/Main/SharpDevelop/SharpDevelop.csproj

14
src/AddIns/Analysis/CodeAnalysis/Src/FxCopLogger.cs

@ -18,20 +18,20 @@ namespace ICSharpCode.CodeAnalysis @@ -18,20 +18,20 @@ namespace ICSharpCode.CodeAnalysis
/// </summary>
public class FxCopLogger : IMSBuildLoggerFilter
{
public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
public IMSBuildChainedLoggerFilter CreateFilter(IMSBuildLoggerContext context, IMSBuildChainedLoggerFilter nextFilter)
{
engine.OutputTextLine(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.RunningFxCopOn} " + Path.GetFileNameWithoutExtension(engine.ProjectFileName)));
return new FxCopLoggerImpl(engine, nextFilter);
context.OutputTextLine(StringParser.Parse("${res:ICSharpCode.CodeAnalysis.RunningFxCopOn} " + context.ProjectFileName.GetFileNameWithoutExtension()));
return new FxCopLoggerImpl(context, nextFilter);
}
sealed class FxCopLoggerImpl : IMSBuildChainedLoggerFilter
{
readonly MSBuildEngine engineWorker;
readonly IMSBuildLoggerContext context;
readonly IMSBuildChainedLoggerFilter nextChainElement;
public FxCopLoggerImpl(MSBuildEngine engineWorker, IMSBuildChainedLoggerFilter nextChainElement)
public FxCopLoggerImpl(IMSBuildLoggerContext context, IMSBuildChainedLoggerFilter nextChainElement)
{
this.engineWorker = engineWorker;
this.context = context;
this.nextChainElement = nextChainElement;
}
@ -47,7 +47,7 @@ namespace ICSharpCode.CodeAnalysis @@ -47,7 +47,7 @@ namespace ICSharpCode.CodeAnalysis
{
error.FileName = null;
}
IProject project = ProjectService.GetProject(new FileName(engineWorker.ProjectFileName));
var project = context.Project;
if (project != null) {
if (error.FileName != null) {
int pos = error.FileName.IndexOf("positionof#", StringComparison.Ordinal);

6
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs

@ -8,6 +8,7 @@ using System.Diagnostics; @@ -8,6 +8,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
@ -85,10 +86,9 @@ namespace CSharpBinding @@ -85,10 +86,9 @@ namespace CSharpBinding
public override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor)
{
if (this.MinimumSolutionVersion == SolutionFormatVersion.VS2005) {
return MSBuildEngine.BuildAsync(
return SD.MSBuildEngine.BuildAsync(
this, options, feedbackSink, progressMonitor.CancellationToken,
MSBuildEngine.AdditionalTargetFiles.Concat(
new [] { Path.Combine(MSBuildEngine.SharpDevelopBinPath, "SharpDevelop.CheckMSBuild35Features.targets") }));
new [] { Path.Combine(FileUtility.ApplicationRootPath, @"bin\SharpDevelop.CheckMSBuild35Features.targets") });
} else {
return base.BuildAsync(options, feedbackSink, progressMonitor);
}

1
src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj

@ -164,7 +164,6 @@ @@ -164,7 +164,6 @@
<Compile Include="Utils\MockTypeResolutionService.cs" />
<Compile Include="Utils\MockViewContent.cs" />
<Compile Include="Utils\MockWorkbench.cs" />
<Compile Include="Utils\MSBuildEngineHelper.cs" />
<Compile Include="Utils\NullPropertyUserControl.cs" />
<Compile Include="Utils\SupportInitCustomControl.cs" />
<Compile Include="Utils\TestableScriptingConsole.cs" />

39
src/AddIns/BackendBindings/Scripting/Test/Utils/MSBuildEngineHelper.cs

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using ICSharpCode.Scripting;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Scripting.Tests.Utils
{
public sealed class MSBuildEngineHelper
{
MSBuildEngineHelper()
{
}
/// <summary>
/// The MSBuildEngine sets theBinPath so if
/// the Build.Tasks assembly is shadow copied it refers
/// to the shadow copied assembly not the original. This
/// causes problems for python projects that refer to the
/// SharpDevelop.*.Build.targets import via $(BinPath)
/// so here we change it so it points to the real BinPath
/// binary.
/// </summary>
public static void InitMSBuildEngine(string binPathName, string addInRelativePath, Type typeForCodeBase)
{
MSBuildEngine.MSBuildProperties.Remove(binPathName);
// Set the bin path property so it points to
// the actual bin path where the Build.Tasks was built not
// to the shadow copy folder.
string codeBase = typeForCodeBase.Assembly.CodeBase.Replace("file:///", String.Empty);
string folder = Path.GetDirectoryName(codeBase);
folder = Path.GetFullPath(Path.Combine(folder, addInRelativePath));
MSBuildEngine.MSBuildProperties[binPathName] = folder;
}
}
}

7
src/AddIns/BackendBindings/WixBinding/Project/Src/Project/WixProject.cs

@ -8,6 +8,7 @@ using System.ComponentModel; @@ -8,6 +8,7 @@ using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
@ -166,9 +167,9 @@ namespace ICSharpCode.WixBinding @@ -166,9 +167,9 @@ namespace ICSharpCode.WixBinding
/// </summary>
string IWixPropertyValueProvider.GetValue(string name)
{
string propertyValue;
if (MSBuildEngine.MSBuildProperties.TryGetValue(name, out propertyValue)) {
return propertyValue;
foreach (var pair in SD.MSBuildEngine.GlobalBuildProperties) {
if (MSBuildInternals.PropertyNameComparer.Equals(pair.Key, name))
return pair.Value;
}
return null;
}

7
src/AddIns/BackendBindings/WixBinding/Test/Project/GetPreprocessorVariableValueTests.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
@ -58,14 +59,14 @@ namespace WixBinding.Tests.Project @@ -58,14 +59,14 @@ namespace WixBinding.Tests.Project
/// Tests that SharpDevelop constants (e.g. ${SharpDevelopBinPath})
/// are expanded if the preprocessor variable uses one.
/// </summary>
[Test]
[Test, Ignore("See comment in WixProject.GetValue()")]
public void VariableValueUsingSharpDevelopConstant()
{
MSBuildEngine.MSBuildProperties.Add("MyAppBinPath", @"C:\Program Files\MyApp\bin");
WixProject p = WixBindingTestsHelper.CreateEmptyWixProject();
// SD.MSBuildEngine.GlobalBuildProperties is stubbed by
((Dictionary<string, string>)SD.MSBuildEngine.GlobalBuildProperties).Add("MyAppBinPath", @"C:\Program Files\MyApp\bin");
p.SetProperty("DefineConstants", @" DATADIR = $(MyAppBinPath)\Bitmaps ");
string variableValue = p.GetPreprocessorVariableValue("DATADIR");
MSBuildEngine.MSBuildProperties.Remove("MyAppBinPath");
Assert.AreEqual(@"C:\Program Files\MyApp\bin\Bitmaps", variableValue);
}
}

6
src/AddIns/BackendBindings/WixBinding/Test/Utils/WixBindingTestsHelper.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Resources;
@ -85,7 +86,10 @@ namespace WixBinding.Tests.Utils @@ -85,7 +86,10 @@ namespace WixBinding.Tests.Utils
string codeBase = typeof(WixBindingTestsHelper).Assembly.CodeBase.Replace("file:///", String.Empty);
string folder = Path.GetDirectoryName(codeBase);
string fileName = Path.Combine(folder, "wix2010.targets");
MSBuildEngine.MSBuildProperties["WixTargetsPath"] = fileName;
SD.Services.RemoveService(typeof(IMSBuildEngine));
SD.Services.AddService(typeof(IMSBuildEngine), MockRepository.GenerateStrictMock<IMSBuildEngine>());
var globalBuildProperties = new Dictionary<string, string> { { "WixTargetsPath", fileName } };
SD.MSBuildEngine.Stub(e => e.GlobalBuildProperties).Return(globalBuildProperties);
}
/// <summary>

72
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
<DefineConstants>TRACE;PUBLICINTERPROCESS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Tasks.v4.0" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
@ -69,7 +69,6 @@ @@ -69,7 +69,6 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -83,18 +82,6 @@ @@ -83,18 +82,6 @@
<Compile Include="..\..\..\Libraries\ICSharpCode.Build.Tasks\Project\KnownFrameworkAssemblies.cs">
<Link>Src\Gui\Dialogs\ReferenceDialog\KnownFrameworkAssemblies.cs</Link>
</Compile>
<Compile Include="..\..\ICSharpCode.SharpDevelop.BuildWorker\BuildJob.cs">
<Link>Src\Project\MSBuildEngine\BuildJob.cs</Link>
</Compile>
<Compile Include="..\..\ICSharpCode.SharpDevelop.BuildWorker\EventSource.cs">
<Link>Src\Project\MSBuildEngine\EventSource.cs</Link>
</Compile>
<Compile Include="..\..\ICSharpCode.SharpDevelop.BuildWorker\EventTypes.cs">
<Link>Src\Project\MSBuildEngine\EventTypes.cs</Link>
</Compile>
<Compile Include="..\..\ICSharpCode.SharpDevelop.BuildWorker\ExtendedBinaryReader.cs">
<Link>Src\Project\MSBuildEngine\ExtendedBinaryReader.cs</Link>
</Compile>
<Compile Include="Designer\IDesignerTypeResolutionService.cs" />
<Compile Include="Designer\TypeResolutionService.cs" />
<Compile Include="Dom\ConcatModelCollection.cs" />
@ -162,12 +149,13 @@ @@ -162,12 +149,13 @@
<Compile Include="Project\Build\IBuildable.cs" />
<Compile Include="Project\Build\IBuildFeedbackSink.cs" />
<Compile Include="Project\Build\IBuildService.cs" />
<Compile Include="Project\Build\IMSBuildEngine.cs" />
<Compile Include="Project\Build\MultipleProjectBuildable.cs" />
<Compile Include="Project\Build\ProjectBuildOptions.cs" />
<Compile Include="Project\ConfigurationAndPlatform.cs" />
<Compile Include="Project\IConfigurable.cs" />
<Compile Include="Project\IConfigurationMapping.cs" />
<Compile Include="Project\IConfigurationOrPlatformNameCollection.cs" />
<Compile Include="Project\Configuration\ConfigurationAndPlatform.cs" />
<Compile Include="Project\Configuration\IConfigurable.cs" />
<Compile Include="Project\Configuration\IConfigurationMapping.cs" />
<Compile Include="Project\Configuration\IConfigurationOrPlatformNameCollection.cs" />
<Compile Include="Project\IProjectService.cs" />
<Compile Include="Project\ISolution.cs" />
<Compile Include="Project\ISolutionFolder.cs" />
@ -177,6 +165,7 @@ @@ -177,6 +165,7 @@
<Compile Include="Refactoring\ICodeGenerator.cs" />
<Compile Include="Services\IClipboard.cs" />
<Compile Include="Services\IMessageLoop.cs" />
<Compile Include="Services\IUIService.cs" />
<Compile Include="Services\SD.cs" />
<Compile Include="Src\Commands\SharpDevelopRoutedCommands.cs" />
<Compile Include="Src\Commands\ViewInBrowser.cs" />
@ -271,7 +260,6 @@ @@ -271,7 +260,6 @@
<Compile Include="Util\SimpleTaskScheduler.cs" />
<Compile Include="Util\TreeNode.cs" />
<Compile Include="Util\UnclosableStream.cs" />
<Compile Include="Util\WeakCollection.cs" />
<Compile Include="WinForms\IClipboardHandler.cs" />
<Compile Include="WinForms\IContextHelpProvider.cs" />
<Compile Include="WinForms\IPrintable.cs" />
@ -439,10 +427,6 @@ @@ -439,10 +427,6 @@
<DependentUpon>ToolNotFoundDialog.cs</DependentUpon>
</Compile>
<Compile Include="Src\Gui\Dialogs\OptionPanels\XmlFormsOptionPanel.cs" />
<Compile Include="Src\Gui\Dialogs\SolutionConfiguration\AddNewConfigurationDialog.cs" />
<Compile Include="Src\Gui\Dialogs\SolutionConfiguration\AddNewConfigurationDialog.Designer.cs">
<DependentUpon>AddNewConfigurationDialog.cs</DependentUpon>
</Compile>
<Compile Include="Src\Gui\Dialogs\TabbedOptionsDialog.xaml.cs">
<DependentUpon>TabbedOptionsDialog.xaml</DependentUpon>
<SubType>Code</SubType>
@ -489,27 +473,20 @@ @@ -489,27 +473,20 @@
<Compile Include="Src\Project\IProjectItemBackendStore.cs" />
<Compile Include="Src\Project\Items\ServiceReferenceProjectItem.cs" />
<Compile Include="Src\Project\Items\ServiceReferencesProjectItem.cs" />
<Compile Include="Src\Project\MSBuildEngine\MSBuildAdditionalLogger.cs" />
<Compile Include="Src\Project\MSBuildEngine\MSBuildLoggerFilter.cs" />
<Compile Include="Src\Project\MSBuildEngine\SDConsoleLogger.cs" />
<Compile Include="Src\Project\MSBuildEngine\BuildWorkerManager.cs" />
<Compile Include="Src\Project\MSBuildEngine\MSBuildEngine.cs" />
<Compile Include="Src\Project\MSBuildEngine\TargetingPackWarningWorkaround.cs" />
<Compile Include="Src\Project\MSBuildEngine\WorkerProcess.cs" />
<Compile Include="Src\Project\MSBuildFileProject.cs" />
<Compile Include="Src\Project\MSBuildItemWrapper.cs" />
<Compile Include="Src\Project\PortableLibrary\CheckPortableLibraryInstalled.cs" />
<Compile Include="Src\Project\PortableLibrary\ConvertToPortableLibraryProjectBehavior.cs" />
<Compile Include="Src\Project\PortableLibrary\PickPortableTargetFramework.cs" />
<Compile Include="Src\Project\PortableLibrary\PortableLibraryProjectBehavior.cs" />
<Compile Include="Src\Project\PortableLibrary\PortableTargetFramework.cs" />
<Compile Include="Src\Project\PortableLibrary\Profile.cs" />
<Compile Include="Src\Project\PortableLibrary\ProfileList.cs" />
<Compile Include="Src\Project\PortableLibrary\SelectProfileDialog.xaml.cs">
<Compile Include="Project\PortableLibrary\CheckPortableLibraryInstalled.cs" />
<Compile Include="Project\PortableLibrary\ConvertToPortableLibraryProjectBehavior.cs" />
<Compile Include="Project\PortableLibrary\PickPortableTargetFramework.cs" />
<Compile Include="Project\PortableLibrary\PortableLibraryProjectBehavior.cs" />
<Compile Include="Project\PortableLibrary\PortableTargetFramework.cs" />
<Compile Include="Project\PortableLibrary\Profile.cs" />
<Compile Include="Project\PortableLibrary\ProfileList.cs" />
<Compile Include="Project\PortableLibrary\SelectProfileDialog.xaml.cs">
<DependentUpon>SelectProfileDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Project\PortableLibrary\SupportedFramework.cs" />
<Compile Include="Project\PortableLibrary\SupportedFramework.cs" />
<Compile Include="Src\Project\ProjectChangeWatcher.cs" />
<Compile Include="Src\Project\ProjectCustomToolOptions.cs" />
<Compile Include="Src\Project\ProjectLoadInformation.cs" />
@ -804,16 +781,8 @@ @@ -804,16 +781,8 @@
<Compile Include="Src\Services\HelpProvider.cs" />
<Compile Include="Src\Services\ParserService\CodeCompletionOptions.cs" />
<Compile Include="Src\Internal\ConditionEvaluators\CompareProjectPropertyConditionEvaluator.cs" />
<Compile Include="Src\Gui\Dialogs\SolutionConfiguration\SolutionConfigurationEditor.Designer.cs">
<DependentUpon>SolutionConfigurationEditor.cs</DependentUpon>
</Compile>
<Compile Include="Src\Gui\Dialogs\SolutionConfiguration\SolutionConfigurationEditor.cs" />
<Compile Include="Src\Gui\Dialogs\SharpDevelopColorDialog.cs" />
<Compile Include="Src\Project\CustomTool.cs" />
<Compile Include="Src\Gui\Dialogs\SolutionConfiguration\EditAvailableConfigurationsDialog.Designer.cs">
<DependentUpon>EditAvailableConfigurationsDialog.cs</DependentUpon>
</Compile>
<Compile Include="Src\Gui\Dialogs\SolutionConfiguration\EditAvailableConfigurationsDialog.cs" />
<Compile Include="Src\Project\MSBuildBasedProject.cs" />
<Compile Include="Src\Project\MSBuildItemDefinitionGroup.cs" />
<Compile Include="Src\Project\AbstractProject.cs" />
@ -828,12 +797,10 @@ @@ -828,12 +797,10 @@
<EmbeddedResource Include="Src\Gui\Dialogs\NewProjectDialog.resx">
<DependentUpon>NewProjectDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Src\Gui\Dialogs\SolutionConfiguration\AddNewConfigurationDialog.resx">
<DependentUpon>AddNewConfigurationDialog.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Designer" />
<Folder Include="Project\Configuration" />
<Folder Include="Workbench\DisplayBinding" />
<Page Include="Editor\Bookmarks\BookmarkPadContent.xaml" />
<Page Include="Src\Editor\CodeCompletion\CodeCompletionPanelXaml.xaml" />
@ -863,7 +830,7 @@ @@ -863,7 +830,7 @@
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AddServiceReferenceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AdvancedServiceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel.xaml" />
<Page Include="Src\Project\PortableLibrary\SelectProfileDialog.xaml" />
<Page Include="Project\PortableLibrary\SelectProfileDialog.xaml" />
<Page Include="themes\generic.xaml" />
<ProjectReference Include="..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
@ -898,7 +865,7 @@ @@ -898,7 +865,7 @@
<Folder Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference" />
<Folder Include="Refactoring" />
<Folder Include="Src\Project\Behaviors" />
<Folder Include="Src\Project\PortableLibrary" />
<Folder Include="Project\PortableLibrary" />
<Folder Include="themes" />
<Folder Include="Src\Editor\AvalonEdit" />
<Folder Include="Editor\CodeCompletion" />
@ -911,7 +878,6 @@ @@ -911,7 +878,6 @@
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private>
</ProjectReference>
<Folder Include="Src\Gui\Dialogs\SolutionConfiguration" />
<ProjectReference Include="..\..\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>

9
src/Main/Base/Project/Project/Build/BuildError.cs

@ -49,6 +49,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -49,6 +49,7 @@ namespace ICSharpCode.SharpDevelop.Project
string contextMenuAddInTreeEntry;
string subcategory;
string helpKeyword;
IProject parentProject;
public string HelpKeyword {
get { return helpKeyword; }
@ -115,6 +116,14 @@ namespace ICSharpCode.SharpDevelop.Project @@ -115,6 +116,14 @@ namespace ICSharpCode.SharpDevelop.Project
set { isMessage = value; }
}
/// <summary>
/// The project that contains this error. This property can be null.
/// </summary>
public IProject ParentProject {
get { return parentProject; }
set { parentProject = value; }
}
/// <summary>
/// Allows to store any object with this error. An object might be attached by a custom
/// MSBuild logger and later read by the context menu command.

168
src/Main/Base/Project/Project/Build/IMSBuildEngine.cs

@ -0,0 +1,168 @@ @@ -0,0 +1,168 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Interface to static MSBuildEngine methods.
/// </summary>
[SDService]
public interface IMSBuildEngine
{
/// <summary>
/// Gets a list of the task names that cause a "Compiling ..." log message.
/// You can add items to this set by putting strings into
/// "/SharpDevelop/MSBuildEngine/CompileTaskNames".
/// </summary>
ISet<string> CompileTaskNames { get; }
/// <summary>
/// Gets the global MSBuild properties.
/// You can add items to this dictionary by putting strings into
/// "/SharpDevelop/MSBuildEngine/AdditionalProperties".
/// </summary>
IEnumerable<KeyValuePair<string, string>> GlobalBuildProperties { get; }
/// <summary>
/// Gets a list of additional target files that are automatically loaded into all projects.
/// You can add items into this list by putting strings into
/// "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles"
/// </summary>
IList<FileName> AdditionalTargetFiles { get; }
/// <summary>
/// Gets a list of additional MSBuild loggers.
/// You can register your loggers by putting them into
/// "/SharpDevelop/MSBuildEngine/AdditionalLoggers"
/// </summary>
IList<IMSBuildAdditionalLogger> AdditionalMSBuildLoggers { get; }
/// <summary>
/// Gets a list of MSBuild logger filter.
/// You can register your loggers by putting them into
/// "/SharpDevelop/MSBuildEngine/LoggerFilters"
/// </summary>
IList<IMSBuildLoggerFilter> MSBuildLoggerFilters { get; }
/// <summary>
/// Resolves the location of the reference files.
/// </summary>
IList<ReferenceProjectItem> ResolveAssemblyReferences(
MSBuildBasedProject baseProject,
ReferenceProjectItem[] additionalReferences = null, bool resolveOnlyAdditionalReferences = false,
bool logErrorsToOutputPad = true);
/// <summary>
/// Compiles the specified project using MSBuild.
/// </summary>
/// <param name="project">The project to be built.</param>
/// <param name="options">The options to use for building this project.</param>
/// <param name="feedbackSink">Callback for errors/warning and log messages</param>
/// <param name="cancellationToken">Cancellation token for aborting the build</param>
/// <param name="additionalTargetFiles">Additional MSBuild target files that should be included in the build.
/// Note: target files specified in the AddInTree path "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles" are always included
/// and do not have to be specified.
/// </param>
/// <returns>True if the build completes successfully; false otherwise.</returns>
Task<bool> BuildAsync(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, CancellationToken cancellationToken, IEnumerable<string> additionalTargetFiles = null);
}
public interface IMSBuildLoggerContext
{
/// <summary>
/// The project being built.
/// </summary>
IProject Project { get; }
/// <summary>
/// Gets the name of the project file being compiled by this engine.
/// </summary>
FileName ProjectFileName { get; }
/// <summary>
/// Controls whether messages should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
bool ReportMessageEvents { get; set; }
/// <summary>
/// Controls whether the TargetStarted event should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
bool ReportTargetStartedEvents { get; set; }
/// <summary>
/// Controls whether the TargetStarted event should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
bool ReportTargetFinishedEvents { get; set; }
/// <summary>
/// Controls whether all TaskStarted events should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
bool ReportAllTaskStartedEvents { get; set; }
/// <summary>
/// Controls whether all TaskFinished events should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
bool ReportAllTaskFinishedEvents { get; set; }
/// <summary>
/// Controls whether the AnyEventRaised and StatusEventRaised events should
/// be called for unknown events.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
bool ReportUnknownEvents { get; set; }
/// <summary>
/// The list of task names for which TaskStarted and TaskFinished events should be
/// made available to loggers.
/// Logger AddIns should add entries in their CreateLogger method.
/// </summary>
ISet<string> InterestingTasks { get; }
/// <summary>
/// Outputs a text line into the message log.
/// </summary>
void OutputTextLine(string text);
/// <summary>
/// Reports an error. This method bypasses the logger filter chain.
/// </summary>
void ReportError(BuildError error);
}
/// <summary>
/// Interface for elements in /SharpDevelop/MSBuildEngine/AdditionalLoggers
/// </summary>
public interface IMSBuildAdditionalLogger
{
Microsoft.Build.Framework.ILogger CreateLogger(IMSBuildLoggerContext context);
}
/// <summary>
/// Interface for elements in /SharpDevelop/MSBuildEngine/LoggerFilters
/// </summary>
public interface IMSBuildLoggerFilter
{
IMSBuildChainedLoggerFilter CreateFilter(IMSBuildLoggerContext context, IMSBuildChainedLoggerFilter nextFilter);
}
/// <summary>
/// Element in the logger filter chain.
/// Receives build events and errors and forwards them to the next element in the chain (possibly after modifying the event).
/// </summary>
public interface IMSBuildChainedLoggerFilter
{
void HandleError(BuildError error);
void HandleBuildEvent(Microsoft.Build.Framework.BuildEventArgs e);
}
}

0
src/Main/Base/Project/Project/ConfigurationAndPlatform.cs → src/Main/Base/Project/Project/Configuration/ConfigurationAndPlatform.cs

0
src/Main/Base/Project/Project/IConfigurable.cs → src/Main/Base/Project/Project/Configuration/IConfigurable.cs

0
src/Main/Base/Project/Project/IConfigurationMapping.cs → src/Main/Base/Project/Project/Configuration/IConfigurationMapping.cs

0
src/Main/Base/Project/Project/IConfigurationOrPlatformNameCollection.cs → src/Main/Base/Project/Project/Configuration/IConfigurationOrPlatformNameCollection.cs

4
src/Main/Base/Project/Project/ISolution.cs

@ -85,7 +85,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -85,7 +85,9 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>
/// Saves the solution.
/// This will also save all modified projects within this solution.
///
/// This method will not save the project files. Use <see cref="ProjectService.SaveSolution"/> instead to save the solution
/// and all open projects.
/// </summary>
void Save();
}

0
src/Main/Base/Project/Src/Project/PortableLibrary/CheckPortableLibraryInstalled.cs → src/Main/Base/Project/Project/PortableLibrary/CheckPortableLibraryInstalled.cs

0
src/Main/Base/Project/Src/Project/PortableLibrary/ConvertToPortableLibraryProjectBehavior.cs → src/Main/Base/Project/Project/PortableLibrary/ConvertToPortableLibraryProjectBehavior.cs

0
src/Main/Base/Project/Src/Project/PortableLibrary/PickPortableTargetFramework.cs → src/Main/Base/Project/Project/PortableLibrary/PickPortableTargetFramework.cs

0
src/Main/Base/Project/Src/Project/PortableLibrary/PortableLibraryProjectBehavior.cs → src/Main/Base/Project/Project/PortableLibrary/PortableLibraryProjectBehavior.cs

0
src/Main/Base/Project/Src/Project/PortableLibrary/PortableTargetFramework.cs → src/Main/Base/Project/Project/PortableLibrary/PortableTargetFramework.cs

2
src/Main/Base/Project/Src/Project/PortableLibrary/Profile.cs → src/Main/Base/Project/Project/PortableLibrary/Profile.cs

@ -69,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Project.PortableLibrary @@ -69,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Project.PortableLibrary
this.DisplayName = PortableSubsetDisplayName + " (" + string.Join(", ", supportedFrameworks) + ")";
}
public bool Supports(IList<SupportedFramework> frameworks)
public bool Supports(IEnumerable<SupportedFramework> frameworks)
{
return frameworks.All(
requiredFx => SupportedFrameworks.Any(fx => fx.IsMoreGeneralThan(requiredFx))

0
src/Main/Base/Project/Src/Project/PortableLibrary/ProfileList.cs → src/Main/Base/Project/Project/PortableLibrary/ProfileList.cs

0
src/Main/Base/Project/Src/Project/PortableLibrary/SelectProfileDialog.xaml → src/Main/Base/Project/Project/PortableLibrary/SelectProfileDialog.xaml

0
src/Main/Base/Project/Src/Project/PortableLibrary/SelectProfileDialog.xaml.cs → src/Main/Base/Project/Project/PortableLibrary/SelectProfileDialog.xaml.cs

0
src/Main/Base/Project/Src/Project/PortableLibrary/SupportedFramework.cs → src/Main/Base/Project/Project/PortableLibrary/SupportedFramework.cs

18
src/Main/Base/Project/Services/IUIService.cs

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop
{
/// <summary>
/// SharpDevelop UI service.
///
/// This service provides methods for accessing the dialogs and other UI element built into SharpDevelop.
/// </summary>
public interface IUIService
{
void ShowSolutionConfigurationEditorDialog(ISolution solution);
}
}

10
src/Main/Base/Project/Services/SD.cs

@ -210,5 +210,15 @@ namespace ICSharpCode.SharpDevelop @@ -210,5 +210,15 @@ namespace ICSharpCode.SharpDevelop
public static IProjectService ProjectService {
get { return GetRequiredService<IProjectService>(); }
}
/// <inheritdoc see="IUIService"/>
public static IUIService UIService {
get { return GetRequiredService<IUIService>(); }
}
/// <inheritdoc see="IUIService"/>
public static IMSBuildEngine MSBuildEngine {
get { return GetRequiredService<IMSBuildEngine>(); }
}
}
}

6
src/Main/Base/Project/Src/Commands/BuildCommands.cs

@ -277,10 +277,8 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -277,10 +277,8 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
{
public override void Run()
{
using (SolutionConfigurationEditor sce = new SolutionConfigurationEditor()) {
sce.ShowDialog(SD.WinForms.MainWin32Window);
ProjectService.SaveSolution();
}
if (SD.ProjectService.OpenSolution != null)
SD.UIService.ShowSolutionConfigurationEditorDialog(SD.ProjectService.OpenSolution);
}
}
}

4
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs

@ -272,7 +272,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -272,7 +272,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
});
MSBuildInternals.ResolveAssemblyReferences(project, referenceItems.ToArray(), resolveOnlyAdditionalReferences: true, logErrorsToOutputPad: false);
SD.MSBuildEngine.ResolveAssemblyReferences(project, referenceItems.ToArray(), resolveOnlyAdditionalReferences: true, logErrorsToOutputPad: false);
SD.MainThread.InvokeAsyncAndForget(delegate {
if (IsDisposed) {
@ -317,7 +317,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -317,7 +317,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
});
MSBuildInternals.ResolveAssemblyReferences(project, referenceItems.ToArray(), resolveOnlyAdditionalReferences: true, logErrorsToOutputPad: false);
SD.MSBuildEngine.ResolveAssemblyReferences(project, referenceItems.ToArray(), resolveOnlyAdditionalReferences: true, logErrorsToOutputPad: false);
foreach (ReferenceProjectItem rpi in referenceItems) {
if (string.IsNullOrEmpty(rpi.Redist)) continue;
if (!redistNameToRequiredFramework.ContainsKey(rpi.Redist)) {

120
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/AddNewConfigurationDialog.resx

@ -1,120 +0,0 @@ @@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

3
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/ProjectNode.cs

@ -140,7 +140,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -140,7 +140,8 @@ namespace ICSharpCode.SharpDevelop.Project
public override void Delete()
{
project.ParentFolder.Items.Remove(project);
((ISolutionFolderNode)Parent).Folder.Items.Remove(project);
base.Remove();
}
public override bool EnableCopy {

2
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/SolutionItemNode.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Project
public override void Delete()
{
item.ParentFolder.Items.Remove(item);
((ISolutionFolderNode)Parent).Folder.Items.Remove(item);
base.Remove();
}

30
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -147,7 +147,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -147,7 +147,7 @@ namespace ICSharpCode.SharpDevelop.Project
ReferenceProjectItem[] additionalItems = {
new ReferenceProjectItem(this, "mscorlib")
};
return MSBuildInternals.ResolveAssemblyReferences(this, additionalItems);
return SD.MSBuildEngine.ResolveAssemblyReferences(this, additionalItems);
}
#region Create new project
@ -393,7 +393,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -393,7 +393,9 @@ namespace ICSharpCode.SharpDevelop.Project
}
Dictionary<string, string> globalProps = new Dictionary<string, string>();
InitializeMSBuildProjectProperties(globalProps);
var msbuildEngine = SD.Services.GetService<IMSBuildEngine>();
if (msbuildEngine != null)
globalProps.AddRange(msbuildEngine.GlobalBuildProperties);
globalProps["Configuration"] = configuration;
globalProps["Platform"] = platform;
MSBuild.Project project = MSBuildInternals.LoadProject(MSBuildProjectCollection, projectFile, globalProps);
@ -1070,7 +1072,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1070,7 +1072,7 @@ namespace ICSharpCode.SharpDevelop.Project
public override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor)
{
return MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken, MSBuildEngine.AdditionalTargetFiles);
return SD.MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken);
}
public override ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable)
@ -1107,28 +1109,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1107,28 +1109,6 @@ namespace ICSharpCode.SharpDevelop.Project
#region Loading
protected bool isLoading;
/// <summary>
/// Set compilation properties (MSBuildProperties and AddInTree/AdditionalPropertiesPath).
/// </summary>
internal static void InitializeMSBuildProjectProperties(IDictionary<string, string> globalProperties)
{
foreach (KeyValuePair<string, string> entry in MSBuildEngine.MSBuildProperties) {
globalProperties[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(MSBuildEngine.AdditionalPropertiesPath, false);
if (node != null) {
foreach (Codon codon in node.Codons) {
object item = node.BuildChildItem(codon, null);
if (item != null) {
string text = item.ToString();
globalProperties[codon.Id] = text;
}
}
}
}
public MSBuildBasedProject(ProjectLoadInformation loadInformation)
: base(loadInformation)
{

2
src/Main/Base/Project/Src/Project/MSBuildFileProject.cs

@ -19,7 +19,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -19,7 +19,7 @@ namespace ICSharpCode.SharpDevelop.Project
public override Task<bool> BuildAsync(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, IProgressMonitor progressMonitor)
{
return MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken, MSBuildEngine.AdditionalTargetFiles);
return SD.MSBuildEngine.BuildAsync(this, options, feedbackSink, progressMonitor.CancellationToken);
}
}
}

147
src/Main/Base/Project/Src/Project/MSBuildInternals.cs

@ -4,15 +4,9 @@ @@ -4,15 +4,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Parser;
using Microsoft.Build.Construction;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
using Microsoft.Build.Logging;
using MSBuild = Microsoft.Build;
using ProjectCollection = Microsoft.Build.Evaluation.ProjectCollection;
namespace ICSharpCode.SharpDevelop.Project
{
@ -23,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -23,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// SharpDevelop uses one project collection per solution.
/// Code accessing one of those collection (even if indirectly through MSBuild) should lock on
/// Code accessing one of those collections (even if indirectly through MSBuild) should lock on
/// MSBuildInternals.SolutionProjectCollectionLock.
/// </summary>
public readonly static object SolutionProjectCollectionLock = new object();
@ -135,144 +129,5 @@ namespace ICSharpCode.SharpDevelop.Project @@ -135,144 +129,5 @@ namespace ICSharpCode.SharpDevelop.Project
location |= PropertyStorageLocations.PlatformSpecific;
return location;
}
/// <summary>
/// Resolves the location of the reference files.
/// </summary>
/// <param name="baseProject">The base project.</param>
/// <param name="referenceReplacements">A different set of references to use instead of those in the project.
/// Used by the GacReferencePanel.</param>
public static IList<ReferenceProjectItem> ResolveAssemblyReferences(
MSBuildBasedProject baseProject,
ReferenceProjectItem[] additionalReferences = null, bool resolveOnlyAdditionalReferences = false,
bool logErrorsToOutputPad = true)
{
ProjectInstance project = baseProject.CreateProjectInstance();
project.SetProperty("BuildingProject", "false");
project.SetProperty("DesignTimeBuild", "true");
List<ProjectItemInstance> references = (
from item in project.Items
where ItemType.ReferenceItemTypes.Contains(new ItemType(item.ItemType))
select item
).ToList();
List<ReferenceProjectItem> referenceProjectItems;
if (resolveOnlyAdditionalReferences) {
// Remove existing references from project
foreach (ProjectItemInstance reference in references) {
project.RemoveItem(reference);
}
references.Clear();
referenceProjectItems = new List<ReferenceProjectItem>();
} else {
// Remove the "Private" meta data.
// This is necessary to detect the default value for "Private"
foreach (ProjectItemInstance reference in references) {
reference.RemoveMetadata("Private");
}
referenceProjectItems = baseProject.Items.OfType<ReferenceProjectItem>().ToList();
}
if (additionalReferences != null) {
referenceProjectItems.AddRange(additionalReferences);
foreach (ReferenceProjectItem item in additionalReferences) {
references.Add(project.AddItem("Reference", item.Include));
}
}
List<string> targets = new List<string>();
if (baseProject.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
targets.Add("ResolveReferences");
targets.Add("DesignTimeResolveAssemblyReferences");
} else {
targets.Add("ResolveAssemblyReferences");
}
BuildRequestData requestData = new BuildRequestData(project, targets.ToArray(), new HostServices());
List<ILogger> loggers = new List<ILogger>();
//loggers.Add(new ConsoleLogger(LoggerVerbosity.Diagnostic));
if (logErrorsToOutputPad)
loggers.Add(new SimpleErrorLogger());
lock (SolutionProjectCollectionLock) {
BuildParameters parameters = new BuildParameters(baseProject.MSBuildProjectCollection);
parameters.Loggers = loggers;
//LoggingService.Debug("Started build for ResolveAssemblyReferences");
BuildResult result = BuildManager.DefaultBuildManager.Build(parameters, requestData);
if (result == null)
throw new InvalidOperationException("BuildResult is null");
//LoggingService.Debug("Build for ResolveAssemblyReferences finished: " + result.OverallResult);
}
IEnumerable<ProjectItemInstance> resolvedAssemblyProjectItems = project.GetItems("_ResolveAssemblyReferenceResolvedFiles");
var query =
from msbuildItem in resolvedAssemblyProjectItems
where msbuildItem.GetMetadataValue("ReferenceSourceTarget") != "ProjectReference"
let originalInclude = msbuildItem.GetMetadataValue("OriginalItemSpec")
join item in referenceProjectItems.Where(p => p.ItemType != ItemType.ProjectReference) on originalInclude equals item.Include into referenceItems
select new {
OriginalInclude = originalInclude,
AssemblyName = new DomAssemblyName(msbuildItem.GetMetadataValue("FusionName")),
FullPath = FileUtility.GetAbsolutePath(baseProject.Directory, msbuildItem.GetMetadataValue("Identity")),
Redist = msbuildItem.GetMetadataValue("Redist"),
CopyLocal = bool.Parse(msbuildItem.GetMetadataValue("CopyLocal")),
ReferenceItems = referenceItems
};
// HACK: mscorlib is reported twice for portable library projects (even if we don't specify it as additionalReference)
query = query.DistinctBy(asm => asm.FullPath);
List<ReferenceProjectItem> resolvedAssemblies = new List<ReferenceProjectItem>();
List<ReferenceProjectItem> handledReferenceItems = new List<ReferenceProjectItem>();
foreach (var assembly in query) {
//LoggingService.Debug("Got information about " + assembly.OriginalInclude + "; fullpath=" + assembly.FullPath);
foreach (var referenceItem in assembly.ReferenceItems) {
referenceItem.AssemblyName = assembly.AssemblyName;
referenceItem.FileName = assembly.FullPath;
referenceItem.Redist = assembly.Redist;
referenceItem.DefaultCopyLocalValue = assembly.CopyLocal;
handledReferenceItems.Add(referenceItem);
}
ReferenceProjectItem firstItem = assembly.ReferenceItems.FirstOrDefault();
if (firstItem != null) {
resolvedAssemblies.Add(firstItem);
} else {
resolvedAssemblies.Add(new ReferenceProjectItem(baseProject, assembly.OriginalInclude) { FileName = assembly.FullPath });
}
}
// Add any assemblies that weren't resolved yet. This is important - for example, this adds back project references.
foreach (var referenceItem in referenceProjectItems.Except(handledReferenceItems)) {
resolvedAssemblies.Add(referenceItem);
}
return resolvedAssemblies;
}
sealed class SimpleErrorLogger : ILogger
{
#region ILogger interface implementation
public LoggerVerbosity Verbosity { get; set; }
public string Parameters { get; set; }
public void Initialize(IEventSource eventSource)
{
eventSource.ErrorRaised += OnError;
eventSource.WarningRaised += OnWarning;
}
public void Shutdown()
{
}
#endregion
void OnError(object sender, BuildErrorEventArgs e)
{
TaskService.BuildMessageViewCategory.AppendLine(e.Message);
}
void OnWarning(object sender, BuildWarningEventArgs e)
{
TaskService.BuildMessageViewCategory.AppendLine(e.Message);
}
}
}
}

25
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -377,12 +377,12 @@ namespace ICSharpCode.SharpDevelop.Project @@ -377,12 +377,12 @@ namespace ICSharpCode.SharpDevelop.Project
public static void SaveSolution()
{
if (SD.ProjectService.OpenSolution != null) {
SD.ProjectService.OpenSolution.Save();
/* foreach (IProject project in openSolution.Projects) {
var openSolution = SD.ProjectService.OpenSolution;
if (openSolution != null) {
openSolution.Save();
foreach (IProject project in openSolution.Projects) {
project.Save();
}
OnSolutionSaved(new SolutionEventArgs(openSolution));*/
}
}
@ -545,20 +545,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -545,20 +545,6 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
static void OnSolutionSaved(SolutionEventArgs e)
{
if (SolutionSaved != null) {
SolutionSaved(null, e);
}
}
internal static void OnSolutionConfigurationChanged(SolutionConfigurationEventArgs e)
{
if (SolutionConfigurationChanged != null) {
SolutionConfigurationChanged(null, e);
}
}
[Obsolete]
public static bool IsBuilding {
get {
@ -671,13 +657,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -671,13 +657,10 @@ namespace ICSharpCode.SharpDevelop.Project
remove { SD.BuildService.BuildFinished -= value; }
}
public static event SolutionConfigurationEventHandler SolutionConfigurationChanged;
public static event EventHandler<SolutionEventArgs> SolutionCreated;
public static event EventHandler SolutionLoading;
public static event EventHandler<SolutionEventArgs> SolutionLoaded;
public static event EventHandler<SolutionEventArgs> SolutionSaved;
public static event EventHandler<SolutionEventArgs> SolutionClosing;
public static event EventHandler SolutionClosed;

1
src/Main/Core/Project/ICSharpCode.Core.csproj

@ -137,6 +137,7 @@ @@ -137,6 +137,7 @@
<Compile Include="..\..\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Src\Util\WeakCollection.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src\Services\LoggingService" />

15
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -368,10 +368,9 @@ namespace ICSharpCode.Core @@ -368,10 +368,9 @@ namespace ICSharpCode.Core
{
// If Directory.GetFiles() searches the 8.3 name as well as the full name so if the filemask is
// "*.xpt" it will return "Template.xpt~"
bool isExtMatch = Regex.IsMatch(filemask, @"^\*\..{3}$");
bool isExtMatch = filemask != null && Regex.IsMatch(filemask, @"^\*\.[\w\d_]{3}$");
string ext = null;
if (isExtMatch) ext = filemask.Remove(0,1);
string[] empty = new string[0];
if (isExtMatch) ext = filemask.Substring(1);
IEnumerable<string> dir = new[] { directory };
if (searchSubdirectories)
@ -379,11 +378,11 @@ namespace ICSharpCode.Core @@ -379,11 +378,11 @@ namespace ICSharpCode.Core
d => {
try {
if (ignoreHidden)
return Directory.EnumerateDirectories(d).Where(child => IsNotHidden(child));
return Directory.EnumerateDirectories(d).Where(IsNotHidden);
else
return Directory.EnumerateDirectories(d);
} catch (UnauthorizedAccessException) {
return empty;
return new string[0];
}
});
foreach (string d in dir) {
@ -394,6 +393,8 @@ namespace ICSharpCode.Core @@ -394,6 +393,8 @@ namespace ICSharpCode.Core
continue;
}
foreach (string f in files) {
if (ext != null && !f.EndsWith(ext, StringComparison.OrdinalIgnoreCase))
continue; // file extension didn't match
if (!ignoreHidden || IsNotHidden(f))
yield return new FileName(f);
}
@ -464,8 +465,8 @@ namespace ICSharpCode.Core @@ -464,8 +465,8 @@ namespace ICSharpCode.Core
char ch = nameWithoutExtension.Length == 4 ? nameWithoutExtension[3] : '\0';
return !((nameWithoutExtension.StartsWith("COM") ||
nameWithoutExtension.StartsWith("LPT")) &&
return !((nameWithoutExtension.StartsWith("COM", StringComparison.Ordinal) ||
nameWithoutExtension.StartsWith("LPT", StringComparison.Ordinal)) &&
Char.IsDigit(ch));
}

24
src/Main/Core/Project/Src/Util/CommandWrapper.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows.Input;
@ -108,6 +109,7 @@ namespace ICSharpCode.Core @@ -108,6 +109,7 @@ namespace ICSharpCode.Core
throw new ArgumentNullException("conditions");
this.codon = codon;
this.conditions = conditions;
this.canExecuteChangedHandlersToRegisterOnCommand = new WeakCollection<EventHandler>();
}
private CommandWrapper(ICommand command, IReadOnlyCollection<ICondition> conditions)
@ -125,16 +127,20 @@ namespace ICSharpCode.Core @@ -125,16 +127,20 @@ namespace ICSharpCode.Core
commandCreated = true;
addInCommand = CreateCommand(codon);
if (canExecuteChangedHandlersToRegisterOnCommand != null) {
// Creating the command potentially changes the CanExecute state
canExecuteChangedHandlersToRegisterOnCommand(this, EventArgs.Empty);
addInCommand.CanExecuteChanged += canExecuteChangedHandlersToRegisterOnCommand;
var handlers = canExecuteChangedHandlersToRegisterOnCommand.ToArray();
canExecuteChangedHandlersToRegisterOnCommand = null;
foreach (var handler in handlers) {
addInCommand.CanExecuteChanged += handler;
// Creating the command potentially changes the CanExecute state, so we should raise the event handlers once:
handler(this, EventArgs.Empty);
}
}
}
}
EventHandler canExecuteChangedHandlersToRegisterOnCommand;
// maintain weak reference semantics for CanExecuteChanged
WeakCollection<EventHandler> canExecuteChangedHandlersToRegisterOnCommand;
public event EventHandler CanExecuteChanged {
add {
@ -143,8 +149,8 @@ namespace ICSharpCode.Core @@ -143,8 +149,8 @@ namespace ICSharpCode.Core
if (addInCommand != null)
addInCommand.CanExecuteChanged += value;
else
canExecuteChangedHandlersToRegisterOnCommand += value;
else if (canExecuteChangedHandlersToRegisterOnCommand != null)
canExecuteChangedHandlersToRegisterOnCommand.Add(value);
}
remove {
if (conditions.Count > 0 && UnregisterConditionRequerySuggestedHandler != null)
@ -152,8 +158,8 @@ namespace ICSharpCode.Core @@ -152,8 +158,8 @@ namespace ICSharpCode.Core
if (addInCommand != null)
addInCommand.CanExecuteChanged -= value;
else
canExecuteChangedHandlersToRegisterOnCommand -= value;
else if (canExecuteChangedHandlersToRegisterOnCommand != null)
canExecuteChangedHandlersToRegisterOnCommand.Remove(value);
}
}

2
src/Main/Base/Project/Util/WeakCollection.cs → src/Main/Core/Project/Src/Util/WeakCollection.cs

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop
namespace ICSharpCode.Core
{
/// <summary>
/// A collection that allows its elements to be garbage-collected (unless there are other

2
src/Main/SharpDevelop/Project/Build/BuildModifiedProjectsOnlyService.cs

@ -25,8 +25,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -25,8 +25,6 @@ namespace ICSharpCode.SharpDevelop.Project
{
// these actions cause a full recompilation:
ProjectService.SolutionClosed += MarkAllForRecompilation;
ProjectService.SolutionConfigurationChanged += MarkAllForRecompilation;
ProjectService.SolutionSaved += MarkAllForRecompilation;
buildService.BuildFinished += BuildService_BuildFinished;
FileUtility.FileSaved += OnFileSaved;

0
src/Main/Base/Project/Src/Project/MSBuildEngine/BuildWorkerManager.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/BuildWorkerManager.cs

222
src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngine.cs

@ -0,0 +1,222 @@ @@ -0,0 +1,222 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Parser;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Class responsible for building a project using MSBuild.
/// Is called by MSBuildProject.
/// </summary>
sealed class MSBuildEngine : IMSBuildEngine
{
const string CompileTaskNamesPath = "/SharpDevelop/MSBuildEngine/CompileTaskNames";
const string AdditionalTargetFilesPath = "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles";
const string AdditionalLoggersPath = "/SharpDevelop/MSBuildEngine/AdditionalLoggers";
const string LoggerFiltersPath = "/SharpDevelop/MSBuildEngine/LoggerFilters";
const string AdditionalPropertiesPath = "/SharpDevelop/MSBuildEngine/AdditionalProperties";
public ISet<string> CompileTaskNames { get; private set; }
public IList<FileName> AdditionalTargetFiles { get; private set; }
public IList<IMSBuildAdditionalLogger> AdditionalMSBuildLoggers { get; private set; }
public IList<IMSBuildLoggerFilter> MSBuildLoggerFilters { get; private set; }
public MSBuildEngine()
{
CompileTaskNames = new SortedSet<string>(
AddInTree.BuildItems<string>(CompileTaskNamesPath, null, false),
StringComparer.OrdinalIgnoreCase
);
AdditionalTargetFiles = SD.AddInTree.BuildItems<string>(AdditionalTargetFilesPath, null, false).Select(FileName.Create).ToList();
AdditionalMSBuildLoggers = SD.AddInTree.BuildItems<IMSBuildAdditionalLogger>(AdditionalLoggersPath, null, false).ToList();
MSBuildLoggerFilters = SD.AddInTree.BuildItems<IMSBuildLoggerFilter>(LoggerFiltersPath, null, false).ToList();
}
public IEnumerable<KeyValuePair<string, string>> GlobalBuildProperties {
get {
yield return new KeyValuePair<string, string>("SharpDevelopBinPath", Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location));
// 'BuildingSolutionFile' tells MSBuild that we took care of building a project's dependencies
// before trying to build the project itself. This speeds up compilation because it prevents MSBuild from
// repeatedly looking if a project needs to be rebuilt.
yield return new KeyValuePair<string, string>("BuildingSolutionFile", "true");
// BuildingSolutionFile does not work in MSBuild 4.0 anymore, but BuildingInsideVisualStudio
// can be used to get the same effect.
yield return new KeyValuePair<string, string>("BuildingInsideVisualStudio", "true");
// Re-load these properties from AddInTree every time because "text" might contain
// SharpDevelop properties resolved by the StringParser (e.g. ${property:FxCopPath}).
// (this is also why this is an enumerable implemented with yield return)
AddInTreeNode node = AddInTree.GetTreeNode(MSBuildEngine.AdditionalPropertiesPath, false);
if (node != null) {
foreach (Codon codon in node.Codons) {
object item = node.BuildChildItem(codon, null);
if (item != null) {
string text = item.ToString();
yield return new KeyValuePair<string, string>(codon.Id, text);
}
}
}
}
}
public Task<bool> BuildAsync(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, CancellationToken cancellationToken, IEnumerable<string> additionalTargetFiles)
{
if (project == null)
throw new ArgumentNullException("project");
if (options == null)
throw new ArgumentNullException("options");
if (feedbackSink == null)
throw new ArgumentNullException("feedbackSink");
var additionalTargetFileList = additionalTargetFiles != null ? additionalTargetFiles.ToList() : new List<string>();
if (project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
additionalTargetFileList.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets"));
}
var engine = new MSBuildEngineWorker(this, project, options, feedbackSink, additionalTargetFileList);
return engine.RunBuildAsync(cancellationToken);
}
public IList<ReferenceProjectItem> ResolveAssemblyReferences(
MSBuildBasedProject baseProject,
ReferenceProjectItem[] additionalReferences, bool resolveOnlyAdditionalReferences,
bool logErrorsToOutputPad)
{
ProjectInstance project = baseProject.CreateProjectInstance();
project.SetProperty("BuildingProject", "false");
project.SetProperty("DesignTimeBuild", "true");
List<ProjectItemInstance> references = (
from item in project.Items
where ItemType.ReferenceItemTypes.Contains(new ItemType(item.ItemType))
select item
).ToList();
List<ReferenceProjectItem> referenceProjectItems;
if (resolveOnlyAdditionalReferences) {
// Remove existing references from project
foreach (ProjectItemInstance reference in references) {
project.RemoveItem(reference);
}
references.Clear();
referenceProjectItems = new List<ReferenceProjectItem>();
} else {
// Remove the "Private" meta data.
// This is necessary to detect the default value for "Private"
foreach (ProjectItemInstance reference in references) {
reference.RemoveMetadata("Private");
}
referenceProjectItems = baseProject.Items.OfType<ReferenceProjectItem>().ToList();
}
if (additionalReferences != null) {
referenceProjectItems.AddRange(additionalReferences);
foreach (ReferenceProjectItem item in additionalReferences) {
references.Add(project.AddItem("Reference", item.Include));
}
}
List<string> targets = new List<string>();
if (baseProject.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
targets.Add("ResolveReferences");
targets.Add("DesignTimeResolveAssemblyReferences");
} else {
targets.Add("ResolveAssemblyReferences");
}
BuildRequestData requestData = new BuildRequestData(project, targets.ToArray(), new HostServices());
List<ILogger> loggers = new List<ILogger>();
//loggers.Add(new ConsoleLogger(LoggerVerbosity.Diagnostic));
if (logErrorsToOutputPad)
loggers.Add(new SimpleErrorLogger());
lock (MSBuildInternals.SolutionProjectCollectionLock) {
BuildParameters parameters = new BuildParameters(baseProject.MSBuildProjectCollection);
parameters.Loggers = loggers;
//LoggingService.Debug("Started build for ResolveAssemblyReferences");
BuildResult result = BuildManager.DefaultBuildManager.Build(parameters, requestData);
if (result == null)
throw new InvalidOperationException("BuildResult is null");
//LoggingService.Debug("Build for ResolveAssemblyReferences finished: " + result.OverallResult);
}
IEnumerable<ProjectItemInstance> resolvedAssemblyProjectItems = project.GetItems("_ResolveAssemblyReferenceResolvedFiles");
var query =
from msbuildItem in resolvedAssemblyProjectItems
where msbuildItem.GetMetadataValue("ReferenceSourceTarget") != "ProjectReference"
let originalInclude = msbuildItem.GetMetadataValue("OriginalItemSpec")
join item in referenceProjectItems.Where(p => p.ItemType != ItemType.ProjectReference) on originalInclude equals item.Include into referenceItems
select new {
OriginalInclude = originalInclude,
AssemblyName = new DomAssemblyName(msbuildItem.GetMetadataValue("FusionName")),
FullPath = FileUtility.GetAbsolutePath(baseProject.Directory, msbuildItem.GetMetadataValue("Identity")),
Redist = msbuildItem.GetMetadataValue("Redist"),
CopyLocal = bool.Parse(msbuildItem.GetMetadataValue("CopyLocal")),
ReferenceItems = referenceItems
};
// HACK: mscorlib is reported twice for portable library projects (even if we don't specify it as additionalReference)
query = query.DistinctBy(asm => asm.FullPath);
List<ReferenceProjectItem> resolvedAssemblies = new List<ReferenceProjectItem>();
List<ReferenceProjectItem> handledReferenceItems = new List<ReferenceProjectItem>();
foreach (var assembly in query) {
//LoggingService.Debug("Got information about " + assembly.OriginalInclude + "; fullpath=" + assembly.FullPath);
foreach (var referenceItem in assembly.ReferenceItems) {
referenceItem.AssemblyName = assembly.AssemblyName;
referenceItem.FileName = assembly.FullPath;
referenceItem.Redist = assembly.Redist;
referenceItem.DefaultCopyLocalValue = assembly.CopyLocal;
handledReferenceItems.Add(referenceItem);
}
ReferenceProjectItem firstItem = assembly.ReferenceItems.FirstOrDefault();
if (firstItem != null) {
resolvedAssemblies.Add(firstItem);
} else {
resolvedAssemblies.Add(new ReferenceProjectItem(baseProject, assembly.OriginalInclude) { FileName = assembly.FullPath });
}
}
// Add any assemblies that weren't resolved yet. This is important - for example, this adds back project references.
foreach (var referenceItem in referenceProjectItems.Except(handledReferenceItems)) {
resolvedAssemblies.Add(referenceItem);
}
return resolvedAssemblies;
}
sealed class SimpleErrorLogger : ILogger
{
#region ILogger interface implementation
public LoggerVerbosity Verbosity { get; set; }
public string Parameters { get; set; }
public void Initialize(IEventSource eventSource)
{
eventSource.ErrorRaised += OnError;
eventSource.WarningRaised += OnWarning;
}
public void Shutdown()
{
}
#endregion
void OnError(object sender, BuildErrorEventArgs e)
{
TaskService.BuildMessageViewCategory.AppendLine(e.Message);
}
void OnWarning(object sender, BuildWarningEventArgs e)
{
TaskService.BuildMessageViewCategory.AppendLine(e.Message);
}
}
}
}

184
src/Main/Base/Project/Src/Project/MSBuildEngine/MSBuildEngine.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildEngineWorker.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)using System;
using System;
using System.Collections.Generic;
@ -11,182 +11,52 @@ using System.Threading.Tasks; @@ -11,182 +11,52 @@ using System.Threading.Tasks;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.BuildWorker;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Build.Framework;
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Class responsible for building a project using MSBuild.
/// Is called by MSBuildProject.
/// </summary>
public sealed class MSBuildEngine
class MSBuildEngineWorker : IMSBuildLoggerContext
{
const string CompileTaskNamesPath = "/SharpDevelop/MSBuildEngine/CompileTaskNames";
const string AdditionalTargetFilesPath = "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles";
const string AdditionalLoggersPath = "/SharpDevelop/MSBuildEngine/AdditionalLoggers";
const string LoggerFiltersPath = "/SharpDevelop/MSBuildEngine/LoggerFilters";
internal 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
/// "/SharpDevelop/MSBuildEngine/CompileTaskNames".
/// </summary>
public static readonly ICollection<string> CompileTaskNames;
/// <summary>
/// Gets a list where addins can add additional properties for use in MSBuild.
/// </summary>
/// <remarks>
/// Please use the AddIn Tree path "/SharpDevelop/MSBuildEngine/AdditionalProperties"
/// instead of this list.
/// </remarks>
public static readonly IDictionary<string, string> MSBuildProperties = new SortedList<string, string> {
{ "SharpDevelopBinPath", SharpDevelopBinPath },
// 'BuildingSolutionFile' tells MSBuild that we took care of building a project's dependencies
// before trying to build the project itself. This speeds up compilation because it prevents MSBuild from
// repeatedly looking if a project needs to be rebuilt.
{ "BuildingSolutionFile", "true" },
// BuildingSolutionFile does not work in MSBuild 4.0 anymore, but BuildingInsideVisualStudio
// can be used to get the same effect.
{ "BuildingInsideVisualStudio", "true" }
};
/// <summary>
/// Gets a list of additional target files that are automatically loaded into all projects.
/// You can add items into this list by putting strings into
/// "/SharpDevelop/MSBuildEngine/AdditionalTargetFiles"
/// </summary>
public static readonly IList<string> AdditionalTargetFiles;
/// <summary>
/// Gets a list of additional MSBuild loggers.
/// You can register your loggers by putting them into
/// "/SharpDevelop/MSBuildEngine/AdditionalLoggers"
/// </summary>
public static readonly IList<IMSBuildAdditionalLogger> AdditionalMSBuildLoggers;
/// <summary>
/// Gets a list of MSBuild logger filter.
/// You can register your loggers by putting them into
/// "/SharpDevelop/MSBuildEngine/LoggerFilters"
/// </summary>
public static readonly IList<IMSBuildLoggerFilter> MSBuildLoggerFilters;
public static string SharpDevelopBinPath {
get {
return Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location);
}
}
static MSBuildEngine()
{
CompileTaskNames = new SortedSet<string>(
AddInTree.BuildItems<string>(CompileTaskNamesPath, null, false),
StringComparer.OrdinalIgnoreCase
);
AdditionalTargetFiles = AddInTree.BuildItems<string>(AdditionalTargetFilesPath, null, false);
AdditionalMSBuildLoggers = AddInTree.BuildItems<IMSBuildAdditionalLogger>(AdditionalLoggersPath, null, false);
MSBuildLoggerFilters = AddInTree.BuildItems<IMSBuildLoggerFilter>(LoggerFiltersPath, null, false);
}
public static Task<bool> BuildAsync(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, CancellationToken cancellationToken, IEnumerable<string> additionalTargetFiles)
{
if (project == null)
throw new ArgumentNullException("project");
if (options == null)
throw new ArgumentNullException("options");
if (feedbackSink == null)
throw new ArgumentNullException("feedbackSink");
if (additionalTargetFiles == null)
throw new ArgumentNullException("additionalTargetFiles");
MSBuildEngine engine = new MSBuildEngine(project, options, feedbackSink);
engine.additionalTargetFiles = additionalTargetFiles.ToList();
if (project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
engine.additionalTargetFiles.Add(Path.Combine(Path.GetDirectoryName(typeof(MSBuildEngine).Assembly.Location), "SharpDevelop.TargetingPack.targets"));
}
return engine.RunBuildAsync(cancellationToken);
}
readonly string projectFileName;
readonly IMSBuildEngine parentBuildEngine;
readonly FileName projectFileName;
readonly IProject project;
readonly SolutionFormatVersion projectMinimumSolutionVersion;
ProjectBuildOptions options;
IBuildFeedbackSink feedbackSink;
List<string> additionalTargetFiles;
private MSBuildEngine(IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink)
internal MSBuildEngineWorker(IMSBuildEngine parentBuildEngine, IProject project, ProjectBuildOptions options, IBuildFeedbackSink feedbackSink, List<string> additionalTargetFiles)
{
this.parentBuildEngine = parentBuildEngine;
this.project = project;
this.projectFileName = project.FileName;
this.projectMinimumSolutionVersion = project.MinimumSolutionVersion;
this.options = options;
this.feedbackSink = feedbackSink;
this.additionalTargetFiles = additionalTargetFiles;
}
const EventTypes ControllableEvents = EventTypes.Message | EventTypes.TargetStarted | EventTypes.TargetFinished
| EventTypes.TaskStarted | EventTypes.TaskFinished | EventTypes.Unknown;
/// <summary>
/// Controls whether messages should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
public bool ReportMessageEvents { get; set; }
public IProject Project {
get { return project; }
}
public FileName ProjectFileName {
get { return projectFileName; }
}
/// <summary>
/// Controls whether the TargetStarted event should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
public bool ReportMessageEvents { get; set; }
public bool ReportTargetStartedEvents { get; set; }
/// <summary>
/// Controls whether the TargetStarted event should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
public bool ReportTargetFinishedEvents { get; set; }
/// <summary>
/// Controls whether all TaskStarted events should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
public bool ReportAllTaskStartedEvents { get; set; }
/// <summary>
/// Controls whether all TaskFinished events should be made available to loggers.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
public bool ReportAllTaskFinishedEvents { get; set; }
/// <summary>
/// Controls whether the AnyEventRaised and StatusEventRaised events should
/// be called for unknown events.
/// Logger AddIns should set this property in their CreateLogger method.
/// </summary>
public bool ReportUnknownEvents { get; set; }
/// <summary>
/// Gets the name of the project file being compiled by this engine.
/// </summary>
public string ProjectFileName {
get { return projectFileName; }
}
/// <summary>
/// Gets the minimum solution version (VS version) required to open the project.
/// </summary>
public SolutionFormatVersion ProjectMinimumSolutionVersion {
get { return projectMinimumSolutionVersion; }
}
HashSet<string> interestingTasks = new HashSet<string>();
string temporaryFileName;
/// <summary>
/// The list of task names for which TaskStarted and TaskFinished events should be
/// made available to loggers.
/// Logger AddIns should add entries in their CreateLogger method.
/// </summary>
public ICollection<string> InterestingTasks {
public ISet<string> InterestingTasks {
get { return interestingTasks; }
}
@ -194,10 +64,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -194,10 +64,10 @@ namespace ICSharpCode.SharpDevelop.Project
List<ILogger> loggers = new List<ILogger>();
IMSBuildChainedLoggerFilter loggerChain;
Task<bool> RunBuildAsync(CancellationToken cancellationToken)
internal Task<bool> RunBuildAsync(CancellationToken cancellationToken)
{
Dictionary<string, string> globalProperties = new Dictionary<string, string>();
MSBuildBasedProject.InitializeMSBuildProjectProperties(globalProperties);
globalProperties.AddRange(SD.MSBuildEngine.GlobalBuildProperties);
foreach (KeyValuePair<string, string> pair in options.Properties) {
LoggingService.Debug("Setting property " + pair.Key + " to '" + pair.Value + "'");
@ -209,7 +79,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -209,7 +79,7 @@ namespace ICSharpCode.SharpDevelop.Project
else
globalProperties["Platform"] = options.Platform;
InterestingTasks.AddRange(MSBuildEngine.CompileTaskNames);
InterestingTasks.AddRange(parentBuildEngine.CompileTaskNames);
loggers.Add(new SharpDevelopLogger(this));
if (options.BuildOutputVerbosity == BuildOutputVerbosity.Diagnostic) {
@ -223,12 +93,12 @@ namespace ICSharpCode.SharpDevelop.Project @@ -223,12 +93,12 @@ namespace ICSharpCode.SharpDevelop.Project
globalProperties["MSBuildTargetsVerbose"] = "true";
}
//loggers.Add(new BuildLogFileLogger(project.FileName + ".log", LoggerVerbosity.Diagnostic));
foreach (IMSBuildAdditionalLogger loggerProvider in MSBuildEngine.AdditionalMSBuildLoggers) {
foreach (IMSBuildAdditionalLogger loggerProvider in parentBuildEngine.AdditionalMSBuildLoggers) {
loggers.Add(loggerProvider.CreateLogger(this));
}
loggerChain = new EndOfChain(this);
foreach (IMSBuildLoggerFilter loggerFilter in MSBuildEngine.MSBuildLoggerFilters) {
foreach (IMSBuildLoggerFilter loggerFilter in parentBuildEngine.MSBuildLoggerFilters) {
loggerChain = loggerFilter.CreateFilter(this, loggerChain) ?? loggerChain;
}
@ -353,9 +223,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -353,9 +223,9 @@ namespace ICSharpCode.SharpDevelop.Project
sealed class EndOfChain : IMSBuildChainedLoggerFilter
{
readonly MSBuildEngine engine;
readonly MSBuildEngineWorker engine;
public EndOfChain(MSBuildEngine engine)
public EndOfChain(MSBuildEngineWorker engine)
{
this.engine = engine;
}
@ -373,9 +243,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -373,9 +243,9 @@ namespace ICSharpCode.SharpDevelop.Project
sealed class SharpDevelopLogger : ILogger
{
MSBuildEngine engine;
readonly MSBuildEngineWorker engine;
public SharpDevelopLogger(MSBuildEngine engine)
public SharpDevelopLogger(MSBuildEngineWorker engine)
{
this.engine = engine;
}
@ -385,7 +255,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -385,7 +255,7 @@ namespace ICSharpCode.SharpDevelop.Project
void OnTaskStarted(object sender, TaskStartedEventArgs e)
{
activeTaskName = e.TaskName;
if (MSBuildEngine.CompileTaskNames.Contains(e.TaskName.ToLowerInvariant())) {
if (engine.parentBuildEngine.CompileTaskNames.Contains(e.TaskName)) {
engine.OutputTextLine(StringParser.Parse("${res:MainWindow.CompilerMessages.CompileVerb} " + Path.GetFileNameWithoutExtension(e.ProjectFile)));
}
}

32
src/Main/Base/Project/Src/Project/MSBuildEngine/MSBuildLoggerFilter.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/MSBuildLoggerFilter.cs

@ -7,24 +7,6 @@ using Microsoft.Build.Framework; @@ -7,24 +7,6 @@ using Microsoft.Build.Framework;
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Interface for elements in /SharpDevelop/MSBuildEngine/LoggerFilters
/// </summary>
public interface IMSBuildLoggerFilter
{
IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter);
}
/// <summary>
/// Element in the logger filter chain.
/// Receives build events and errors and forwards them to the next element in the chain (possibly after modifying the event).
/// </summary>
public interface IMSBuildChainedLoggerFilter
{
void HandleError(BuildError error);
void HandleBuildEvent(Microsoft.Build.Framework.BuildEventArgs e);
}
/// <summary>
/// Creates <see cref="IMSBuildLoggerFilter"/> objects that are only
/// activated when a specific MSBuild task is running.
@ -73,30 +55,30 @@ namespace ICSharpCode.SharpDevelop.Project @@ -73,30 +55,30 @@ namespace ICSharpCode.SharpDevelop.Project
addIn = codon.AddIn;
}
public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
public IMSBuildChainedLoggerFilter CreateFilter(IMSBuildLoggerContext context, IMSBuildChainedLoggerFilter nextFilter)
{
if (nextFilter == null)
throw new ArgumentNullException("nextFilter");
// ensure the engine gets notified about start/end of this task
engine.InterestingTasks.Add(taskname);
context.InterestingTasks.Add(taskname);
// Create a Filter that tracks whether the task is active.
// If active, forward to 'baseFilter', otherwise forward to 'nextFilter'.
return new TaskBoundLoggerFilter(this, engine, nextFilter);
return new TaskBoundLoggerFilter(this, context, nextFilter);
}
}
sealed class TaskBoundLoggerFilter : IMSBuildChainedLoggerFilter
{
readonly TaskBoundLoggerFilterDescriptor desc;
readonly MSBuildEngine engine;
readonly IMSBuildLoggerContext context;
readonly IMSBuildChainedLoggerFilter nextFilter;
IMSBuildChainedLoggerFilter baseFilter = null;
bool insideTask = false;
public TaskBoundLoggerFilter(TaskBoundLoggerFilterDescriptor desc, MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
public TaskBoundLoggerFilter(TaskBoundLoggerFilterDescriptor desc, IMSBuildLoggerContext context, IMSBuildChainedLoggerFilter nextFilter)
{
this.desc = desc;
this.engine = engine;
this.context = context;
this.nextFilter = nextFilter;
}
@ -116,7 +98,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -116,7 +98,7 @@ namespace ICSharpCode.SharpDevelop.Project
if (baseFilter == null) {
IMSBuildLoggerFilter baseLoggerFilter = (IMSBuildLoggerFilter)desc.addIn.CreateObject(desc.classname);
if (baseLoggerFilter != null)
baseFilter = baseLoggerFilter.CreateFilter(engine, nextFilter) ?? nextFilter;
baseFilter = baseLoggerFilter.CreateFilter(context, nextFilter) ?? nextFilter;
else
baseFilter = nextFilter;
}

0
src/Main/Base/Project/Src/Project/MSBuildEngine/SDConsoleLogger.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/SDConsoleLogger.cs

6
src/Main/Base/Project/Src/Project/MSBuildEngine/TargetingPackWarningWorkaround.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/TargetingPackWarningWorkaround.cs

@ -8,7 +8,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -8,7 +8,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>
/// Suppresses the warning MSB3644.
/// </summary>
public sealed class TargetingPackWarningWorkaround : IMSBuildLoggerFilter
sealed class TargetingPackWarningWorkaround : IMSBuildLoggerFilter
{
/*
* Warning MSB3644: The reference assemblies for framework
@ -20,9 +20,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -20,9 +20,9 @@ namespace ICSharpCode.SharpDevelop.Project
* Therefore your assembly may not be correctly targeted for the framework you intend.
*/
public IMSBuildChainedLoggerFilter CreateFilter(MSBuildEngine engine, IMSBuildChainedLoggerFilter nextFilter)
public IMSBuildChainedLoggerFilter CreateFilter(IMSBuildLoggerContext context, IMSBuildChainedLoggerFilter nextFilter)
{
if (engine.ProjectMinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
if (context.Project.MinimumSolutionVersion >= SolutionFormatVersion.VS2010) {
return new TargetingPackWarningWorkaroundChainEntry(nextFilter);
} else {
return nextFilter;

24
src/Main/Base/Project/Src/Project/MSBuildEngine/MSBuildAdditionalLogger.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/TaskBoundAdditionalLoggerDoozer.cs

@ -7,14 +7,6 @@ using Microsoft.Build.Framework; @@ -7,14 +7,6 @@ using Microsoft.Build.Framework;
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Interface for elements in /SharpDevelop/MSBuildEngine/AdditionalLoggers
/// </summary>
public interface IMSBuildAdditionalLogger
{
ILogger CreateLogger(MSBuildEngine engine);
}
/// <summary>
/// Creates <see cref="IMSBuildAdditionalLogger"/> objects that are only
/// activated when a specific MSBuild task is running.
@ -37,7 +29,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -37,7 +29,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// A IMSBuildAdditionalLogger object that lazy-loads the specified
/// IMSBuildAdditionalLogger when the specified task is running.
/// </returns>
public class TaskBoundAdditionalLoggerDoozer : IDoozer
class TaskBoundAdditionalLoggerDoozer : IDoozer
{
public bool HandleConditions {
get {
@ -63,24 +55,24 @@ namespace ICSharpCode.SharpDevelop.Project @@ -63,24 +55,24 @@ namespace ICSharpCode.SharpDevelop.Project
addIn = codon.AddIn;
}
public ILogger CreateLogger(MSBuildEngine engine)
public ILogger CreateLogger(IMSBuildLoggerContext context)
{
engine.InterestingTasks.Add(taskname);
return new TaskBoundAdditionalLogger(this, engine);
context.InterestingTasks.Add(taskname);
return new TaskBoundAdditionalLogger(this, context);
}
}
private class TaskBoundAdditionalLogger : ILogger
{
TaskBoundAdditionalLoggerDescriptor desc;
MSBuildEngine engine;
IMSBuildLoggerContext context;
ILogger baseLogger;
bool isActive;
public TaskBoundAdditionalLogger(TaskBoundAdditionalLoggerDescriptor desc, MSBuildEngine engine)
public TaskBoundAdditionalLogger(TaskBoundAdditionalLoggerDescriptor desc, IMSBuildLoggerContext context)
{
this.desc = desc;
this.engine = engine;
this.context = context;
}
void CreateBaseLogger()
@ -90,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -90,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Project
baseLogger = obj as ILogger;
IMSBuildAdditionalLogger addLog = obj as IMSBuildAdditionalLogger;
if (addLog != null) {
baseLogger = addLog.CreateLogger(engine);
baseLogger = addLog.CreateLogger(context);
}
}
}

0
src/Main/Base/Project/Src/Project/MSBuildEngine/WorkerProcess.cs → src/Main/SharpDevelop/Project/Build/MSBuildEngine/WorkerProcess.cs

2
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/AddNewConfigurationDialog.Designer.cs → src/Main/SharpDevelop/Project/Configuration/AddNewConfigurationDialog.Designer.cs generated

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
namespace ICSharpCode.SharpDevelop.Gui
namespace ICSharpCode.SharpDevelop.Project
{
partial class AddNewConfigurationDialog : System.Windows.Forms.Form
{

4
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/AddNewConfigurationDialog.cs → src/Main/SharpDevelop/Project/Configuration/AddNewConfigurationDialog.cs

@ -8,12 +8,12 @@ using System.Linq; @@ -8,12 +8,12 @@ using System.Linq;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Gui
namespace ICSharpCode.SharpDevelop.Project
{
/// <summary>
/// Dialog for adding a new configuration or platform to a solution or project.
/// </summary>
public partial class AddNewConfigurationDialog
internal partial class AddNewConfigurationDialog
{
Predicate<string> checkNameValid;

0
src/Main/SharpDevelop/Project/ConfigurationMapping.cs → src/Main/SharpDevelop/Project/Configuration/ConfigurationMapping.cs

2
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/EditAvailableConfigurationsDialog.Designer.cs → src/Main/SharpDevelop/Project/Configuration/EditAvailableConfigurationsDialog.Designer.cs generated

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
namespace ICSharpCode.SharpDevelop.Gui
namespace ICSharpCode.SharpDevelop.Project
{
partial class EditAvailableConfigurationsDialog : System.Windows.Forms.Form
{

4
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/EditAvailableConfigurationsDialog.cs → src/Main/SharpDevelop/Project/Configuration/EditAvailableConfigurationsDialog.cs

@ -10,9 +10,9 @@ using System.Windows.Forms; @@ -10,9 +10,9 @@ using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui
namespace ICSharpCode.SharpDevelop.Project
{
public partial class EditAvailableConfigurationsDialog
internal partial class EditAvailableConfigurationsDialog
{
readonly IConfigurable configurable;
readonly bool editPlatforms;

2
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/SolutionConfigurationEditor.Designer.cs → src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationEditor.Designer.cs generated

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
namespace ICSharpCode.SharpDevelop.Gui
namespace ICSharpCode.SharpDevelop.Project
{
partial class SolutionConfigurationEditor : System.Windows.Forms.Form
{

12
src/Main/Base/Project/Src/Gui/Dialogs/SolutionConfiguration/SolutionConfigurationEditor.cs → src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationEditor.cs

@ -9,22 +9,22 @@ using System.Windows.Forms; @@ -9,22 +9,22 @@ using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui
namespace ICSharpCode.SharpDevelop.Project
{
public partial class SolutionConfigurationEditor
internal partial class SolutionConfigurationEditor
{
ISolution solution;
readonly ISolution solution;
bool inUpdate;
int configurationComboBoxEditIndex;
int platformComboBoxEditIndex;
ConfigurationAndPlatform solutionConfig;
public SolutionConfigurationEditor()
public SolutionConfigurationEditor(ISolution solution)
{
this.solution = ProjectService.OpenSolution;
if (solution == null)
throw new Exception("A solution must be opened");
throw new ArgumentNullException("solution");
this.solution = solution;
//
// The InitializeComponent() call is required for Windows Forms designer support.

0
src/Main/SharpDevelop/Project/SolutionConfigurationOrPlatformNameCollection.cs → src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationOrPlatformNameCollection.cs

3
src/Main/SharpDevelop/Project/Solution.cs

@ -192,9 +192,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -192,9 +192,6 @@ namespace ICSharpCode.SharpDevelop.Project
#region Save
public void Save()
{
foreach (var project in this.Projects) {
project.Save();
}
try {
changeWatcher.Disable();
using (var solutionWriter = new SolutionWriter(fileName)) {

1
src/Main/SharpDevelop/Sda/CallHelper.cs

@ -97,7 +97,6 @@ namespace ICSharpCode.SharpDevelop.Sda @@ -97,7 +97,6 @@ namespace ICSharpCode.SharpDevelop.Sda
Project.ProjectService.BuildFinished += delegate { this.callback.EndBuild(); };
Project.ProjectService.SolutionLoaded += delegate { this.callback.SolutionLoaded(); };
Project.ProjectService.SolutionClosed += delegate { this.callback.SolutionClosed(); };
Project.ProjectService.SolutionConfigurationChanged += delegate { this.callback.SolutionConfigurationChanged(); };
FileUtility.FileLoaded += delegate(object sender, FileNameEventArgs e) { this.callback.FileLoaded(e.FileName); };
FileUtility.FileSaved += delegate(object sender, FileNameEventArgs e) { this.callback.FileSaved(e.FileName); };

11
src/Main/SharpDevelop/Sda/SharpDevelopHost.cs

@ -311,11 +311,6 @@ namespace ICSharpCode.SharpDevelop.Sda @@ -311,11 +311,6 @@ namespace ICSharpCode.SharpDevelop.Sda
/// </summary>
public event EventHandler SolutionClosed;
/// <summary>
/// Event when the active solution configuration was changed.
/// </summary>
public event EventHandler SolutionConfigurationChanged;
/// <summary>
/// Event when a file was loaded inside SharpDevelop.
/// </summary>
@ -396,12 +391,6 @@ namespace ICSharpCode.SharpDevelop.Sda @@ -396,12 +391,6 @@ namespace ICSharpCode.SharpDevelop.Sda
if (host.SolutionClosed != null) host.SolutionClosed(host, EventArgs.Empty);
}
internal void SolutionConfigurationChanged()
{
if (InvokeRequired) { Invoke(SolutionConfigurationChanged); return; }
if (host.SolutionConfigurationChanged != null) host.SolutionConfigurationChanged(host, EventArgs.Empty);
}
internal void FileLoaded(string fileName)
{
if (InvokeRequired) { Invoke(FileLoaded, fileName); return; }

23
src/Main/SharpDevelop/Services/UIService.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop
{
class UIService : IUIService
{
public void ShowSolutionConfigurationEditorDialog(ISolution solution)
{
using (SolutionConfigurationEditor sce = new SolutionConfigurationEditor(solution)) {
sce.ShowDialog(SD.WinForms.MainWin32Window);
if (solution.IsDirty)
solution.Save();
foreach (IProject project in solution.Projects) {
project.Save();
}
}
}
}
}

40
src/Main/SharpDevelop/SharpDevelop.csproj

@ -55,6 +55,7 @@ @@ -55,6 +55,7 @@
<HintPath>..\..\Libraries\log4net\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
@ -81,6 +82,18 @@ @@ -81,6 +82,18 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\BuildJob.cs">
<Link>Project\Build\MSBuildEngine\BuildJob.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\EventSource.cs">
<Link>Project\Build\MSBuildEngine\EventSource.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\EventTypes.cs">
<Link>Project\Build\MSBuildEngine\EventTypes.cs</Link>
</Compile>
<Compile Include="..\ICSharpCode.SharpDevelop.BuildWorker\ExtendedBinaryReader.cs">
<Link>Project\Build\MSBuildEngine\ExtendedBinaryReader.cs</Link>
</Compile>
<Compile Include="Dom\ModelFactory.cs" />
<Compile Include="Dom\MemberModel.cs" />
<Compile Include="Dom\NestedTypeDefinitionModelCollection.cs" />
@ -102,17 +115,38 @@ @@ -102,17 +115,38 @@
<Compile Include="Project\Build\BuildEngine.cs" />
<Compile Include="Project\Build\BuildModifiedProjectsOnlyService.cs" />
<Compile Include="Project\Build\BuildService.cs" />
<Compile Include="Project\Build\MSBuildEngine\BuildWorkerManager.cs" />
<Compile Include="Project\Build\MSBuildEngine\MSBuildEngineWorker.cs" />
<Compile Include="Project\Build\MSBuildEngine\TaskBoundAdditionalLoggerDoozer.cs" />
<Compile Include="Project\Build\MSBuildEngine\MSBuildEngine.cs" />
<Compile Include="Project\Build\MSBuildEngine\MSBuildLoggerFilter.cs" />
<Compile Include="Project\Build\MSBuildEngine\SDConsoleLogger.cs" />
<Compile Include="Project\Build\MSBuildEngine\TargetingPackWarningWorkaround.cs" />
<Compile Include="Project\Build\MSBuildEngine\WorkerProcess.cs" />
<Compile Include="Project\Build\UIBuildFeedbackSink.cs" />
<Compile Include="Project\ConfigurationMapping.cs" />
<Compile Include="Project\Configuration\AddNewConfigurationDialog.cs" />
<Compile Include="Project\Configuration\AddNewConfigurationDialog.Designer.cs">
<DependentUpon>AddNewConfigurationDialog.cs</DependentUpon>
</Compile>
<Compile Include="Project\Configuration\ConfigurationMapping.cs" />
<Compile Include="Project\Configuration\EditAvailableConfigurationsDialog.cs" />
<Compile Include="Project\Configuration\EditAvailableConfigurationsDialog.Designer.cs">
<DependentUpon>EditAvailableConfigurationsDialog.cs</DependentUpon>
</Compile>
<Compile Include="Project\Configuration\SolutionConfigurationEditor.cs" />
<Compile Include="Project\Configuration\SolutionConfigurationEditor.Designer.cs">
<DependentUpon>SolutionConfigurationEditor.cs</DependentUpon>
</Compile>
<Compile Include="Project\Configuration\SolutionConfigurationOrPlatformNameCollection.cs" />
<Compile Include="Project\ProjectService.cs" />
<Compile Include="Project\Solution.cs" />
<Compile Include="Project\SolutionConfigurationOrPlatformNameCollection.cs" />
<Compile Include="Project\SolutionFileItem.cs" />
<Compile Include="Project\SolutionFolder.cs" />
<Compile Include="Project\SolutionLoader.cs" />
<Compile Include="Project\SolutionWriter.cs" />
<Compile Include="Services\ClipboardWrapper.cs" />
<Compile Include="Services\DispatcherMessageLoop.cs" />
<Compile Include="Services\UIService.cs" />
<Compile Include="Startup\App.xaml.cs" />
<Compile Include="Startup\SharpDevelopMain.cs" />
<Compile Include="Startup\SplashScreen.cs" />
@ -251,6 +285,8 @@ @@ -251,6 +285,8 @@
<Folder Include="Editor\Bookmarks" />
<Folder Include="Project" />
<Folder Include="Project\Build" />
<Folder Include="Project\Build\MSBuildEngine" />
<Folder Include="Project\Configuration" />
<Folder Include="Services" />
<Folder Include="WinForms" />
<Folder Include="OptionPanels" />

Loading…
Cancel
Save