diff options
author | Michael Hutchinson <mhutchinson@novell.com> | 2009-05-02 02:08:25 +0400 |
---|---|---|
committer | Michael Hutchinson <mhutchinson@novell.com> | 2009-05-02 02:08:25 +0400 |
commit | f1117b806c270bbbd12275ad1af127a978b81da9 (patch) | |
tree | 2025fc334a1a0f4924dfd91dfe8e61fc194152b0 /main/src/addins/prj2make-sharp-lib | |
parent | 07e4fad996b4d0a40dfcdb95fdf7e23610bf6ec4 (diff) |
* Makefile.am:
* prj2make-sharp-lib.csproj:
* prj2make-sharp-lib.addin.xml:
* MSBuildProjectServiceExtension.cs:
* SilverlightMSBuildProjectExtension.cs: Remove unused code and
extensions.
svn path=/trunk/monodevelop/; revision=133295
Diffstat (limited to 'main/src/addins/prj2make-sharp-lib')
6 files changed, 18 insertions, 299 deletions
diff --git a/main/src/addins/prj2make-sharp-lib/ChangeLog b/main/src/addins/prj2make-sharp-lib/ChangeLog index cfc2d68135..6ba63b8c5a 100644 --- a/main/src/addins/prj2make-sharp-lib/ChangeLog +++ b/main/src/addins/prj2make-sharp-lib/ChangeLog @@ -1,3 +1,12 @@ +2009-05-01 Michael Hutchinson <mhutchinson@novell.com> + + * Makefile.am: + * prj2make-sharp-lib.csproj: + * prj2make-sharp-lib.addin.xml: + * MSBuildProjectServiceExtension.cs: + * SilverlightMSBuildProjectExtension.cs: Remove unused code + and extensions. + 2009-04-17 Mike Kestner <mkestner@novell.com> * prj2make-sharp-lib.csproj: don't require specific diff --git a/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs b/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs deleted file mode 100644 index e529f6a0d9..0000000000 --- a/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs +++ /dev/null @@ -1,159 +0,0 @@ -// -// MSBuildProjectServiceExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.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 MonoDevelop.Core; -using MonoDevelop.Core.Execution; -using MonoDevelop.Projects; - -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Text.RegularExpressions; - -namespace MonoDevelop.Prj2Make -{ - public class MSBuildProjectServiceExtension : ProjectServiceExtension - { - - protected override BuildResult Build (IProgressMonitor monitor, IBuildTarget entry, string configuration) - { - //xamlg any SilverLightPages - DotNetProject project = entry as DotNetProject; - if (project == null) - return base.Build (monitor, entry, configuration); - - foreach (ProjectFile pf in project.Files) { - if (pf.BuildAction != BuildAction.EmbeddedResource) - continue; - - //Check for SilverLightPage - if (pf.ExtendedProperties ["MonoDevelop.MSBuildFileFormat.SilverlightPage"] == null) - continue; - - string generated_file_name; - CompilerError error = GenerateXamlPartialClass (pf.Name, out generated_file_name, monitor); - if (error != null) { - CompilerResults cr = new CompilerResults (new TempFileCollection ()); - cr.Errors.Add (error); - - monitor.Log.WriteLine (GettextCatalog.GetString("Build complete -- ") + - GettextCatalog.GetPluralString("{0} error", "{0} errors", cr.Errors.Count) + - GettextCatalog.GetPluralString("{0} warning", "{0} warnings", 0), - cr.Errors.Count, 0); - return new BuildResult (cr, String.Empty); - } - } - - return base.Build (monitor, entry, configuration); - } - - CompilerError GenerateXamlPartialClass (string fname, out string generated_file_name, IProgressMonitor monitor) - { - generated_file_name = fname + ".g.cs"; - - //Check whether resgen required - FileInfo finfo_resx = new FileInfo (fname); - FileInfo finfo_resources = new FileInfo (generated_file_name); - if (finfo_resx.LastWriteTime < finfo_resources.LastWriteTime) - return null; - - using (StringWriter sw = new StringWriter ()) { - LoggingService.LogDebug ("Generating partial classes for\n{0}$ {1} {2}", Path.GetDirectoryName (fname), "xamlg", fname); - monitor.Log.WriteLine (GettextCatalog.GetString ( - "Generating partial classes for {0} with {1}", fname, "xamlg")); - ProcessWrapper pw = null; - try { - ProcessStartInfo info = Runtime.ProcessService.CreateProcessStartInfo ( - "xamlg", String.Format ("\"{0}\"", fname), - Path.GetDirectoryName (fname), false); - - if (PlatformID.Unix == Environment.OSVersion.Platform) - info.EnvironmentVariables ["MONO_IOMAP"] = "drive"; - - pw = Runtime.ProcessService.StartProcess (info, sw, sw, null); - } catch (System.ComponentModel.Win32Exception ex) { - LoggingService.LogError (GettextCatalog.GetString ( - "Error while trying to invoke '{0}' to generate partial classes for '{1}' :\n {2}", "xamlg", fname, ex.ToString ())); - monitor.Log.WriteLine (GettextCatalog.GetString ( - "Error while trying to invoke '{0}' to generate partial classes for '{1}' :\n {2}", "xamlg", fname, ex.Message)); - - return new CompilerError (fname, 0, 0, String.Empty, ex.Message); - } - - //FIXME: Handle exceptions - pw.WaitForOutput (); - - if (pw.ExitCode != 0) { - //FIXME: Stop build on error? - string output = sw.ToString (); - LoggingService.LogError (GettextCatalog.GetString ( - "Unable to generate partial classes ({0}) for {1}. \nReason: \n{2}\n", - "xamlg", fname, output)); - monitor.Log.WriteLine (GettextCatalog.GetString ( - "Unable to generate partial classes ({0}) for {1}. \nReason: \n{2}\n", - "xamlg", fname, output)); - - //Try to get the line/pos - int line = 0; - int pos = 0; - Match match = RegexErrorLinePos.Match (output); - if (match.Success && match.Groups.Count == 3) { - try { - line = int.Parse (match.Groups [1].Value); - } catch (FormatException){ - } - - try { - pos = int.Parse (match.Groups [2].Value); - } catch (FormatException){ - } - } - - return new CompilerError (fname, line, pos, "", output); - } - } - - //No errors - return null; - } - - // Used for parsing "Line 123, position 5" errors from tools - // like resgen, xamlg - static Regex regexErrorLinePos; - static Regex RegexErrorLinePos { - get { - if (regexErrorLinePos == null) - regexErrorLinePos = new Regex (@"Line (\d*), position (\d*)"); - return regexErrorLinePos; - } - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/Makefile.am b/main/src/addins/prj2make-sharp-lib/Makefile.am index f8e8f7c338..7dc084c733 100644 --- a/main/src/addins/prj2make-sharp-lib/Makefile.am +++ b/main/src/addins/prj2make-sharp-lib/Makefile.am @@ -12,12 +12,12 @@ DEPS = \ $(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ $(top_builddir)/build/bin/MonoDevelop.Ide.dll \ $(top_builddir)/build/bin/MonoDevelop.Projects.dll \ - $(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll + $(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll \ + $(top_builddir)/build/bin/NRefactory.dll REFS = \ $(GTK_SHARP_LIBS) \ $(MONO_ADDINS_LIBS) \ - -r:../../../build/bin/NRefactory.dll \ -r:Mono.Posix \ -r:System \ -r:System.Xml @@ -26,7 +26,6 @@ FILES = \ AssemblyInfo.cs \ csproj_ver2003.cs \ CsprojInfo.cs \ - MSBuildProjectServiceExtension.cs \ MsPrjHelper.cs \ pkgconfiginvoker.cs \ VS2003ProjectFileFormat.cs diff --git a/main/src/addins/prj2make-sharp-lib/SilverlightMSBuildProjectExtension.cs b/main/src/addins/prj2make-sharp-lib/SilverlightMSBuildProjectExtension.cs deleted file mode 100644 index 2ed2bd5b80..0000000000 --- a/main/src/addins/prj2make-sharp-lib/SilverlightMSBuildProjectExtension.cs +++ /dev/null @@ -1,112 +0,0 @@ -// -// SilverlightMSBuildProjectExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.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 MonoDevelop.Core; -using MonoDevelop.Projects; - -using System; -using System.Xml; - -namespace MonoDevelop.Prj2Make -{ - - public class SilverlightMSBuildProjectExtension : MSBuildProjectExtension - { - const string myguid = "{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"; - - public override string TypeGuid { - get { return myguid; } - } - - public override string Name { - get { return "Silverlight";} - } - - public override bool Supports (string type_guid, string filename, string type_guids) - { - return (String.Compare (type_guid, myguid, true) == 0); - } - - public override DotNetProject CreateProject (string type_guid, string filename, string type_guids) - { - if (!Supports (type_guid, filename, type_guids)) - throw new InvalidOperationException (String.Format ("Project of type guid = {0} not supported by this extension.", type_guid)); - - int semicolon = type_guids.IndexOf (';'); - if (semicolon < 0 || semicolon == type_guids.Length) - throw new Exception (String.Format ("Invalid type guid. Missing super-type guid")); - - //FIXME: this shouldn't be required - type_guids = type_guids.Substring (semicolon + 1); - type_guid = type_guids.Split (';') [0]; - return base.CreateProject (type_guid, filename, type_guids); - } - - public override void ReadItemGroup (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string include, string basePath, XmlNode node, IProgressMonitor monitor) - { - if (node.LocalName == "SilverlightPage") { - //FIXME: this should be available only for - //<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - // - //This tag also has a - // <Generator>MSBuild:Compile</Generator> - string path = Utils.GetValidPath (monitor, basePath, include); - if (path == null) - return; - - ProjectFile pf = project.AddFile (path, BuildAction.EmbeddedResource); - pf.ExtendedProperties ["MonoDevelop.MSBuildFileFormat.SilverlightPage"] = String.Empty; - data.ProjectFileElements [pf] = (XmlElement) node; - - // Add the corresponding %.g.cs to the project, we'll skip this - // when saving the project file - pf = project.AddFile (path + ".g.cs", BuildAction.Compile); - pf.ExtendedProperties ["MonoDevelop.MSBuildFileFormat.SilverlightGeneratedFile"] = String.Empty; - data.ProjectFileElements [pf] = (XmlElement) node; - } else { - base.ReadItemGroup (data, project, globalConfig, include, basePath, node, monitor); - } - } - - public override XmlElement FileToXmlElement (MSBuildData d, Project project, ProjectFile projectFile) - { - if (projectFile.ExtendedProperties ["MonoDevelop.MSBuildFileFormat.SilverlightGeneratedFile"] != null) - //Ignore the generated %.xaml.g.cs files - return null; - - return base.FileToXmlElement (d, project, projectFile); - } - - public override string GetGuidChain (DotNetProject project) - { - return null; - } - - } - -} diff --git a/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.addin.xml b/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.addin.xml index 429fb19e09..e04a26a877 100644 --- a/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.addin.xml +++ b/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.addin.xml @@ -4,7 +4,7 @@ author = "Francisco 'Paco' Martinez, Ankit Jain" copyright = "GPL" url = "" - description = "Support for VS2005 or MSBuild based projects and importer for VS2003 projects" + description = "Importer for VS2003 projects" category = "Project Import and Export" version = "2.1.0"> @@ -17,11 +17,6 @@ <Addin id="VBBinding" version="2.1.0"/> </Dependencies> - <ExtensionPoint path = "/MonoDevelop/Prj2Make/MSBuildProjectExtension"> - <Description>Extensions to msbuild project support</Description> - <ExtensionNode name ="Class" /> - </ExtensionPoint> - <Extension path = "/MonoDevelop/ProjectModel/FileFormats"> <FileFormat id="VS2003ProjectFileFormat" class="MonoDevelop.Prj2Make.VS2003ProjectFileFormat"/> @@ -35,16 +30,5 @@ _label = "Visual Studio Project" extensions = "*.csproj,*.vbproj"/> </Extension> - - <Extension path = "/MonoDevelop/Prj2Make/MSBuildProjectExtension"> - <Class class="MonoDevelop.Prj2Make.CSharpMSBuildProjectExtension"/> - <Class class="MonoDevelop.Prj2Make.VBNetMSBuildProjectExtension"/> - <Class class="MonoDevelop.Prj2Make.SilverlightMSBuildProjectExtension"/> - </Extension> - - <Extension path = "/MonoDevelop/ProjectModel/ProjectServiceExtensions"> - <Class class = "MonoDevelop.Prj2Make.MSBuildProjectServiceExtension" id="MSBuildProjectServiceExtension" insertafter="InitialStep"/> - </Extension> - </Addin> diff --git a/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.csproj b/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.csproj index e8a8969abe..26e240163b 100644 --- a/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.csproj +++ b/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.csproj @@ -53,11 +53,6 @@ <Reference Include="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> <SpecificVersion>False</SpecificVersion> </Reference> - <Reference Include="NRefactory, Version=1.9.2.0, Culture=neutral, PublicKeyToken=null"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\build\bin\NRefactory.dll</HintPath> - <Private>False</Private> - </Reference> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj"> @@ -110,13 +105,17 @@ <Name>Mono.TextEditor</Name> <Private>False</Private> </ProjectReference> + <ProjectReference Include="..\..\..\contrib\NRefactory\Project\NRefactory.csproj"> + <Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project> + <Name>NRefactory</Name> + <Private>False</Private> + </ProjectReference> </ItemGroup> <ItemGroup> <Compile Include="MsPrjHelper.cs" /> <Compile Include="CsprojInfo.cs" /> <Compile Include="pkgconfiginvoker.cs" /> <Compile Include="csproj_ver2003.cs" /> - <Compile Include="MSBuildProjectServiceExtension.cs" /> <Compile Include="VS2003ProjectFileFormat.cs" /> <Compile Include="AssemblyInfo.cs" /> </ItemGroup> @@ -126,7 +125,6 @@ <ItemGroup> <None Include="Makefile.am" /> <None Include="ChangeLog" /> - <None Include="SilverlightMSBuildProjectExtension.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> @@ -144,4 +142,4 @@ </Properties> </MonoDevelop> </ProjectExtensions> -</Project> +</Project>
\ No newline at end of file |