diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-01-20 19:53:41 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2014-03-31 14:59:28 +0400 |
commit | 3f8cd2226fa8278d30cb59cc90af1e24e06eb495 (patch) | |
tree | 7c04f3a556d2b5804f47a844b651f1fde7571e7c /main/src/core/MonoDevelop.Core | |
parent | c4adbcecb2036ba64e6bbb5544efae6677c5993d (diff) |
Allow customizing the generated MSBuild files
Diffstat (limited to 'main/src/core/MonoDevelop.Core')
4 files changed, 58 insertions, 1 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml index 7fe8caf09c..6562e0e5d8 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.addin.xml @@ -145,6 +145,10 @@ <ExtensionNode objectType="MonoDevelop.Projects.Formats.MSBuild.IMSBuildImportProvider"/> </ExtensionPoint> + <ExtensionPoint path = "/MonoDevelop/ProjectModel/MSBuildExtensions" name = "MSBuild Extensions"> + <ExtensionNode objectType="MonoDevelop.Projects.Formats.MSBuild.MSBuildExtension"/> + </ExtensionPoint> + <ExtensionPoint path = "/MonoDevelop/ProjectModel/MonoDocSources" name = "MonoDoc Sources"> <ExtensionNode name="Source" type="MonoDevelop.Projects.Extensions.MonoDocSourceNode" /> </ExtensionPoint> diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj index 7f8712256b..1874e0e000 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj @@ -458,6 +458,7 @@ <Compile Include="MonoDevelop.Projects\UnknownProject.cs" /> <Compile Include="MonoDevelop.Projects\SharedProject.cs" /> <Compile Include="MonoDevelop.Projects.Formats.MSBuild\SharedProjectMSBuildHandler.cs" /> + <Compile Include="MonoDevelop.Projects.Formats.MSBuild\MSBuildExtension.cs" /> </ItemGroup> <ItemGroup> <None Include="Makefile.am" /> diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildExtension.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildExtension.cs new file mode 100644 index 0000000000..6b1abcd4e8 --- /dev/null +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildExtension.cs @@ -0,0 +1,41 @@ +// +// MSBuildExtension.cs +// +// Author: +// Lluis Sanchez Gual <lluis@xamarin.com> +// +// Copyright (c) 2014 Xamarin, Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; + +namespace MonoDevelop.Projects.Formats.MSBuild +{ + public class MSBuildExtension + { + public virtual void LoadProject (SolutionEntityItem item, MSBuildProject project) + { + } + + public virtual void SaveProject (SolutionEntityItem item, MSBuildProject project) + { + } + } +} + diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs index 987b26fdec..3096e5e974 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs @@ -765,7 +765,10 @@ namespace MonoDevelop.Projects.Formats.MSBuild dotNetProject.TargetFramework = Runtime.SystemAssemblyService.GetTargetFramework (targetFx); } - + + foreach (var ext in GetMSBuildExtensions ()) + ext.LoadProject (EntityItem, msproject); + Item.NeedsReload = false; } @@ -1306,6 +1309,9 @@ namespace MonoDevelop.Projects.Formats.MSBuild } else msproject.RemoveProjectExtensions ("MonoDevelop"); + foreach (var ext in GetMSBuildExtensions ()) + ext.SaveProject (EntityItem, msproject); + return msproject; } @@ -1602,6 +1608,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild existingImports.Remove (imp); } + IEnumerable<MSBuildExtension> GetMSBuildExtensions () + { + return AddinManager.GetExtensionObjects<MSBuildExtension> ("/MonoDevelop/ProjectModel/MSBuildExtensions"); + } + void ReadBuildItemMetadata (DataSerializer ser, MSBuildItem buildItem, object dataItem, Type extendedType) { DataItem ditem = new DataItem (); |